Skip to content

Instantly share code, notes, and snippets.

@subsetpark
Created April 10, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subsetpark/72d7536f7ce790ae7fd0a14e862472fb to your computer and use it in GitHub Desktop.
Save subsetpark/72d7536f7ce790ae7fd0a14e862472fb to your computer and use it in GitHub Desktop.
Wordpress API demo - posts
*[i] zax/SERV-1499/invoice-email ~/frame-src/massdriver & http OPTIONS https://demo.wp-api.org/wp-json/wp/v2/posts
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
Allow: GET
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=UTF-8
Date: Wed, 10 Apr 2019 14:31:49 GMT
Link: <https://demo.wp-api.org/wp-json/>; rel="https://api.w.org/"
Server: nginx
Transfer-Encoding: chunked
Via: 1.1 362e1aab00ef24f4aedd4efdbfdc014b.cloudfront.net (CloudFront)
X-Amz-Cf-Id: HZ_tgTe2cIWfhiuKsOoSCr1da9GBZg6j4_9gWHR2UsemHaAG1sdN-A==
X-Cache: Miss from cloudfront
X-Content-Type-Options: nosniff
X-Robots-Tag: noindex
{
"_links": {
"self": "https://demo.wp-api.org/wp-json/wp/v2/posts"
},
"endpoints": [
{
"args": {
"after": {
"description": "Limit response to posts published after a given ISO8601 compliant date.",
"required": false,
"type": "string"
},
"author": {
"default": [],
"description": "Limit result set to posts assigned to specific authors.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"author_exclude": {
"default": [],
"description": "Ensure result set excludes posts assigned to specific authors.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"before": {
"description": "Limit response to posts published before a given ISO8601 compliant date.",
"required": false,
"type": "string"
},
"categories": {
"default": [],
"description": "Limit result set to all items that have the specified term assigned in the categories taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"categories_exclude": {
"default": [],
"description": "Limit result set to all items except those that have the specified term assigned in the categories taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"context": {
"default": "view",
"description": "Scope under which the request is made; determines fields present in response.",
"enum": [
"view",
"embed",
"edit"
],
"required": false,
"type": "string"
},
"exclude": {
"default": [],
"description": "Ensure result set excludes specific IDs.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"include": {
"default": [],
"description": "Limit result set to specific IDs.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"offset": {
"description": "Offset the result set by a specific number of items.",
"required": false,
"type": "integer"
},
"order": {
"default": "desc",
"description": "Order sort attribute ascending or descending.",
"enum": [
"asc",
"desc"
],
"required": false,
"type": "string"
},
"orderby": {
"default": "date",
"description": "Sort collection by object attribute.",
"enum": [
"author",
"date",
"id",
"include",
"modified",
"parent",
"relevance",
"slug",
"include_slugs",
"title"
],
"required": false,
"type": "string"
},
"page": {
"default": 1,
"description": "Current page of the collection.",
"required": false,
"type": "integer"
},
"per_page": {
"default": 10,
"description": "Maximum number of items to be returned in result set.",
"required": false,
"type": "integer"
},
"search": {
"description": "Limit results to those matching a string.",
"required": false,
"type": "string"
},
"slug": {
"description": "Limit result set to posts with one or more specific slugs.",
"items": {
"type": "string"
},
"required": false,
"type": "array"
},
"status": {
"default": "publish",
"description": "Limit result set to posts assigned one or more statuses.",
"items": {
"enum": [
"publish",
"future",
"draft",
"pending",
"private",
"trash",
"auto-draft",
"inherit",
"request-pending",
"request-confirmed",
"request-failed",
"request-completed",
"any"
],
"type": "string"
},
"required": false,
"type": "array"
},
"sticky": {
"description": "Limit result set to items that are sticky.",
"required": false,
"type": "boolean"
},
"tags": {
"default": [],
"description": "Limit result set to all items that have the specified term assigned in the tags taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"tags_exclude": {
"default": [],
"description": "Limit result set to all items except those that have the specified term assigned in the tags taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
}
},
"methods": [
"GET"
]
},
{
"args": {
"author": {
"description": "The ID for the author of the object.",
"required": false,
"type": "integer"
},
"categories": {
"description": "The terms assigned to the object in the category taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"comment_status": {
"description": "Whether or not comments are open on the object.",
"enum": [
"open",
"closed"
],
"required": false,
"type": "string"
},
"content": {
"description": "The content for the object.",
"required": false,
"type": "object"
},
"date": {
"description": "The date the object was published, in the site's timezone.",
"required": false,
"type": "string"
},
"date_gmt": {
"description": "The date the object was published, as GMT.",
"required": false,
"type": "string"
},
"excerpt": {
"description": "The excerpt for the object.",
"required": false,
"type": "object"
},
"featured_media": {
"description": "The ID of the featured media for the object.",
"required": false,
"type": "integer"
},
"format": {
"description": "The format for the object.",
"enum": [
"standard",
"aside",
"chat",
"gallery",
"link",
"image",
"quote",
"status",
"video",
"audio"
],
"required": false,
"type": "string"
},
"meta": {
"description": "Meta fields.",
"required": false,
"type": "object"
},
"password": {
"description": "A password to protect access to the content and excerpt.",
"required": false,
"type": "string"
},
"ping_status": {
"description": "Whether or not the object can be pinged.",
"enum": [
"open",
"closed"
],
"required": false,
"type": "string"
},
"slug": {
"description": "An alphanumeric identifier for the object unique to its type.",
"required": false,
"type": "string"
},
"status": {
"description": "A named status for the object.",
"enum": [
"publish",
"future",
"draft",
"pending",
"private"
],
"required": false,
"type": "string"
},
"sticky": {
"description": "Whether or not the object should be treated as sticky.",
"required": false,
"type": "boolean"
},
"tags": {
"description": "The terms assigned to the object in the post_tag taxonomy.",
"items": {
"type": "integer"
},
"required": false,
"type": "array"
},
"template": {
"description": "The theme file to use to display the object.",
"required": false,
"type": "string"
},
"title": {
"description": "The title for the object.",
"required": false,
"type": "object"
}
},
"methods": [
"POST"
]
}
],
"methods": [
"GET",
"POST"
],
"namespace": "wp/v2",
"schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"links": [
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-publish",
"targetSchema": {
"properties": {
"status": {
"enum": [
"publish",
"future"
],
"type": "string"
}
},
"type": "object"
},
"title": "The current user can publish this post."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-unfiltered-html",
"targetSchema": {
"properties": {
"content": {
"raw": {
"type": "string"
}
}
},
"type": "object"
},
"title": "The current user can post unfiltered HTML markup and JavaScript."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-sticky",
"targetSchema": {
"properties": {
"sticky": {
"type": "boolean"
}
},
"type": "object"
},
"title": "The current user can sticky this post."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-assign-author",
"targetSchema": {
"properties": {
"author": {
"type": "integer"
}
},
"type": "object"
},
"title": "The current user can change the author on this post."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-assign-categories",
"targetSchema": {
"properties": {
"categories": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"type": "object"
},
"title": "The current user can assign terms in the category taxonomy."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-create-categories",
"targetSchema": {
"properties": {
"categories": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"type": "object"
},
"title": "The current user can create terms in the category taxonomy."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-assign-tags",
"targetSchema": {
"properties": {
"tags": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"type": "object"
},
"title": "The current user can assign terms in the post_tag taxonomy."
},
{
"href": "https://demo.wp-api.org/wp-json/wp/v2/posts/{id}",
"rel": "https://api.w.org/action-create-tags",
"targetSchema": {
"properties": {
"tags": {
"items": {
"type": "integer"
},
"type": "array"
}
},
"type": "object"
},
"title": "The current user can create terms in the post_tag taxonomy."
}
],
"properties": {
"author": {
"context": [
"view",
"edit",
"embed"
],
"description": "The ID for the author of the object.",
"type": "integer"
},
"categories": {
"context": [
"view",
"edit"
],
"description": "The terms assigned to the object in the category taxonomy.",
"items": {
"type": "integer"
},
"type": "array"
},
"comment_status": {
"context": [
"view",
"edit"
],
"description": "Whether or not comments are open on the object.",
"enum": [
"open",
"closed"
],
"type": "string"
},
"content": {
"context": [
"view",
"edit"
],
"description": "The content for the object.",
"properties": {
"block_version": {
"context": [
"edit"
],
"description": "Version of the content block format used by the object.",
"readonly": true,
"type": "integer"
},
"protected": {
"context": [
"view",
"edit",
"embed"
],
"description": "Whether the content is protected with a password.",
"readonly": true,
"type": "boolean"
},
"raw": {
"context": [
"edit"
],
"description": "Content for the object, as it exists in the database.",
"type": "string"
},
"rendered": {
"context": [
"view",
"edit"
],
"description": "HTML content for the object, transformed for display.",
"readonly": true,
"type": "string"
}
},
"type": "object"
},
"date": {
"context": [
"view",
"edit",
"embed"
],
"description": "The date the object was published, in the site's timezone.",
"format": "date-time",
"type": "string"
},
"date_gmt": {
"context": [
"view",
"edit"
],
"description": "The date the object was published, as GMT.",
"format": "date-time",
"type": "string"
},
"excerpt": {
"context": [
"view",
"edit",
"embed"
],
"description": "The excerpt for the object.",
"properties": {
"protected": {
"context": [
"view",
"edit",
"embed"
],
"description": "Whether the excerpt is protected with a password.",
"readonly": true,
"type": "boolean"
},
"raw": {
"context": [
"edit"
],
"description": "Excerpt for the object, as it exists in the database.",
"type": "string"
},
"rendered": {
"context": [
"view",
"edit",
"embed"
],
"description": "HTML excerpt for the object, transformed for display.",
"readonly": true,
"type": "string"
}
},
"type": "object"
},
"featured_media": {
"context": [
"view",
"edit",
"embed"
],
"description": "The ID of the featured media for the object.",
"type": "integer"
},
"format": {
"context": [
"view",
"edit"
],
"description": "The format for the object.",
"enum": [
"standard",
"aside",
"chat",
"gallery",
"link",
"image",
"quote",
"status",
"video",
"audio"
],
"type": "string"
},
"generated_slug": {
"context": [
"edit"
],
"description": "Slug automatically generated from the object title.",
"readonly": true,
"type": "string"
},
"guid": {
"context": [
"view",
"edit"
],
"description": "The globally unique identifier for the object.",
"properties": {
"raw": {
"context": [
"edit"
],
"description": "GUID for the object, as it exists in the database.",
"readonly": true,
"type": "string"
},
"rendered": {
"context": [
"view",
"edit"
],
"description": "GUID for the object, transformed for display.",
"readonly": true,
"type": "string"
}
},
"readonly": true,
"type": "object"
},
"id": {
"context": [
"view",
"edit",
"embed"
],
"description": "Unique identifier for the object.",
"readonly": true,
"type": "integer"
},
"link": {
"context": [
"view",
"edit",
"embed"
],
"description": "URL to the object.",
"format": "uri",
"readonly": true,
"type": "string"
},
"meta": {
"context": [
"view",
"edit"
],
"description": "Meta fields.",
"properties": [],
"type": "object"
},
"modified": {
"context": [
"view",
"edit"
],
"description": "The date the object was last modified, in the site's timezone.",
"format": "date-time",
"readonly": true,
"type": "string"
},
"modified_gmt": {
"context": [
"view",
"edit"
],
"description": "The date the object was last modified, as GMT.",
"format": "date-time",
"readonly": true,
"type": "string"
},
"password": {
"context": [
"edit"
],
"description": "A password to protect access to the content and excerpt.",
"type": "string"
},
"permalink_template": {
"context": [
"edit"
],
"description": "Permalink template for the object.",
"readonly": true,
"type": "string"
},
"ping_status": {
"context": [
"view",
"edit"
],
"description": "Whether or not the object can be pinged.",
"enum": [
"open",
"closed"
],
"type": "string"
},
"slug": {
"context": [
"view",
"edit",
"embed"
],
"description": "An alphanumeric identifier for the object unique to its type.",
"type": "string"
},
"status": {
"context": [
"view",
"edit"
],
"description": "A named status for the object.",
"enum": [
"publish",
"future",
"draft",
"pending",
"private"
],
"type": "string"
},
"sticky": {
"context": [
"view",
"edit"
],
"description": "Whether or not the object should be treated as sticky.",
"type": "boolean"
},
"tags": {
"context": [
"view",
"edit"
],
"description": "The terms assigned to the object in the post_tag taxonomy.",
"items": {
"type": "integer"
},
"type": "array"
},
"template": {
"context": [
"view",
"edit"
],
"description": "The theme file to use to display the object.",
"type": "string"
},
"title": {
"context": [
"view",
"edit",
"embed"
],
"description": "The title for the object.",
"properties": {
"raw": {
"context": [
"edit"
],
"description": "Title for the object, as it exists in the database.",
"type": "string"
},
"rendered": {
"context": [
"view",
"edit",
"embed"
],
"description": "HTML title for the object, transformed for display.",
"readonly": true,
"type": "string"
}
},
"type": "object"
},
"type": {
"context": [
"view",
"edit",
"embed"
],
"description": "Type of Post for the object.",
"readonly": true,
"type": "string"
}
},
"title": "post",
"type": "object"
}
}
[i] zax/SERV-1499/invoice-email ~/frame-src/massdriver & http OPTIONS https://demo.wp-api.org/wp-json/
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
Allow: GET
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=UTF-8
Date: Wed, 10 Apr 2019 14:33:23 GMT
Link: <https://demo.wp-api.org/wp-json/>; rel="https://api.w.org/"
Server: nginx
Transfer-Encoding: chunked
Via: 1.1 addff924747ef8fa8fdad344bcb0ce8f.cloudfront.net (CloudFront)
X-Amz-Cf-Id: ltL-UZn3af_n_MPB7LDmQXzQD4ubo0N8WsKXV-qAQBSZ6wE8QIJpMw==
X-Cache: Miss from cloudfront
X-Content-Type-Options: nosniff
X-Robots-Tag: noindex
{
"_links": {
"self": "https://demo.wp-api.org/wp-json/"
},
"endpoints": [
{
"args": {
"context": {
"default": "view",
"required": false
}
},
"methods": [
"GET"
]
}
],
"methods": [
"GET"
],
"namespace": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment