Skip to content

Instantly share code, notes, and snippets.

@kevindees
Created January 7, 2025 01:25
Show Gist options
  • Save kevindees/bd34b7181650b34232c19349f6bb0fe1 to your computer and use it in GitHub Desktop.
Save kevindees/bd34b7181650b34232c19349f6bb0fe1 to your computer and use it in GitHub Desktop.
chatgpt-action-scheme-wordpress.json
{
"openapi": "3.1.0",
"info": {
"title": "WordPress Blog Content API",
"description": "API specification for retrieving blog posts to be used for ChatGPT content learning.",
"version": "v1.0.0"
},
"servers": [
{
"url": "https://example.com/wp-json/wp/v2",
"description": "Base URL for the WordPress REST API"
}
],
"paths": {
"/search": {
"get": {
"operationId": "searchPosts",
"summary": "Search blog posts",
"description": "Search blog posts by a keyword.",
"parameters": [
{
"name": "search",
"in": "query",
"description": "Keyword to search for in posts.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "per_page",
"in": "query",
"description": "Number of posts to retrieve per page.",
"required": false,
"schema": {
"type": "integer",
"default": 10
}
},
{
"name": "page",
"in": "query",
"description": "The page of results to retrieve.",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
}
],
"responses": {
"200": {
"description": "Search results.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "integer", "description": "ID of the blog post" },
"title": { "type": "string", "description": "Title of the blog post" },
"excerpt": { "type": "string", "description": "Excerpt of the blog post" },
"link": { "type": "string", "description": "URL of the blog post" }
}
}
}
}
}
},
"404": {
"description": "No results found.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": { "type": "string", "description": "Error message" }
}
}
}
}
}
}
}
},
"/posts": {
"post": {
"operationId": "createDraftPost",
"summary": "Create a draft blog post",
"description": "Creates a new draft post on the WordPress blog.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The title of the blog post",
"example": "Exploring AI in Education"
},
"content": {
"type": "string",
"description": "The main content of the blog post",
"example": "AI is transforming education by..."
},
"status": {
"type": "string",
"description": "The status of the blog post (draft by default)",
"enum": ["publish", "draft", "pending"],
"default": "draft"
}
},
"required": ["title", "content"]
}
}
}
},
"responses": {
"201": {
"description": "Draft post created successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The ID of the created post"
},
"link": {
"type": "string",
"description": "The URL of the draft post"
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
}
}
}
}
}
}
}
},
"get": {
"operationId": "getRecentPosts",
"summary": "Fetch recent blog posts",
"description": "Retrieves a list of recent blog posts from the WordPress site.",
"parameters": [
{
"name": "per_page",
"in": "query",
"description": "Number of posts to retrieve per page.",
"required": false,
"schema": {
"type": "integer",
"default": 10
}
},
{
"name": "page",
"in": "query",
"description": "The page of results to retrieve.",
"required": false,
"schema": {
"type": "integer",
"default": 1
}
},
{
"name": "categories",
"in": "query",
"description": "Filter posts by category ID.",
"required": false,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "A list of blog posts.",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "ID of the blog post"
},
"title": {
"type": "object",
"properties": {
"rendered": {
"type": "string",
"description": "Title of the blog post"
}
}
},
"content": {
"type": "object",
"properties": {
"rendered": {
"type": "string",
"description": "Content of the blog post"
}
}
},
"link": {
"type": "string",
"description": "URL of the blog post"
}
}
}
}
}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
}
}
}
}
}
}
}
}
},
"/posts/{id}": {
"get": {
"operationId": "getPostById",
"summary": "Fetch a single blog post by ID",
"description": "Retrieves the content of a single blog post specified by its ID.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The ID of the blog post to retrieve.",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Details of the specified blog post.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "ID of the blog post"
},
"title": {
"type": "object",
"properties": {
"rendered": {
"type": "string",
"description": "Title of the blog post"
}
}
},
"content": {
"type": "object",
"properties": {
"rendered": {
"type": "string",
"description": "Content of the blog post"
}
}
},
"link": {
"type": "string",
"description": "URL of the blog post"
}
}
}
}
}
},
"404": {
"description": "Post not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error message"
}
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment