スキーマ

スキーマはpostオブジェクトに存在するすべてのフィールドを定義しています。

date
string, datetime (ISO8601)

The date the object was published, in the site's timezone.

コンテキスト: view, edit, embed

date_gmt
string, datetime (ISO8601)

The date the object was published, as GMT.

コンテキスト: view, edit

guid
object

The globally unique identifier for the object.

読み取り専用

コンテキスト: view, edit

id
integer

Unique identifier for the object.

読み取り専用

コンテキスト: view, edit, embed

modified
string, datetime (ISO8601)

The date the object was last modified, in the site's timezone.

読み取り専用

コンテキスト: view, edit

modified_gmt
string, datetime (ISO8601)

The date the object was last modified, as GMT.

読み取り専用

コンテキスト: view, edit

slug
string

An alphanumeric identifier for the object unique to its type.

コンテキスト: view, edit, embed

status
string

A named status for the object.

コンテキスト: view, edit

次のいずれか: publish, future, draft, pending, private

type
string

Type of Post for the object.

読み取り専用

コンテキスト: view, edit, embed

password
string

A password to protect access to the content and excerpt.

コンテキスト: edit

generated_slug
string

Slug automatically generated from the object title.

読み取り専用

コンテキスト: edit

title
object

The title for the object.

コンテキスト: view, edit, embed

content
object

The content for the object.

コンテキスト: view, edit

author
integer

The ID for the author of the object.

コンテキスト: view, edit, embed

excerpt
object

The excerpt for the object.

コンテキスト: view, edit, embed

comment_status
string

Whether or not comments are open on the object.

コンテキスト: view, edit

次のいずれか: open, closed

ping_status
string

Whether or not the object can be pinged.

コンテキスト: view, edit

次のいずれか: open, closed

format
string

The format for the object.

コンテキスト: view, edit

次のいずれか: standard, aside, chat, gallery, link, image, quote, status, video, audio

meta
object

Meta fields.

コンテキスト: view, edit

sticky
boolean

Whether or not the object should be treated as sticky.

コンテキスト: view, edit

template
string

The theme file to use to display the object.

コンテキスト: view, edit

categories
array

The terms assigned to the object in the category taxonomy.

コンテキスト: view, edit

tags
array

The terms assigned to the object in the post_tag taxonomy.

コンテキスト: view, edit

Example Request

$ curl -X OPTIONS -i http://demo.wp-api.org/wp-json/wp/v2/posts

Post一覧

引数

context

Scope under which the request is made; determines fields present in response.

初期値: view

次のいずれか: view, embed, edit

page

Current page of the collection.

初期値: 1

per_page

Maximum number of items to be returned in result set.

初期値: 10

search

Limit results to those matching a string.

after

Limit response to posts published after a given ISO8601 compliant date.

author

Limit result set to posts assigned to specific authors.

初期値:

author_exclude

Ensure result set excludes posts assigned to specific authors.

初期値:

before

Limit response to posts published before a given ISO8601 compliant date.

exclude

Ensure result set excludes specific IDs.

初期値:

include

Limit result set to specific IDs.

初期値:

offset

Offset the result set by a specific number of items.

order

Order sort attribute ascending or descending.

初期値: desc

次のいずれか: asc, desc

orderby

Sort collection by object attribute.

初期値: date

次のいずれか: author, date, id, include, modified, parent, relevance, slug, include_slugs, title

slug

Limit result set to posts with one or more specific slugs.

status

Limit result set to posts assigned one or more statuses.

初期値: publish

categories

Limit result set to all items that have the specified term assigned in the categories taxonomy.

初期値:

categories_exclude

Limit result set to all items except those that have the specified term assigned in the categories taxonomy.

初期値:

tags

Limit result set to all items that have the specified term assigned in the tags taxonomy.

初期値:

tags_exclude

Limit result set to all items except those that have the specified term assigned in the tags taxonomy.

初期値:

sticky

Limit result set to items that are sticky.

定義

GET /wp/v2/posts

リクエスト例

$ curl http://demo.wp-api.org/wp-json/wp/v2/posts

Postを取得する

引数

id

Unique identifier for the object.

context

Scope under which the request is made; determines fields present in response.

初期値: view

次のいずれか: view, embed, edit

password

The password for the post if it is password protected.

定義

GET /wp/v2/posts/<id>

リクエスト例

$ curl http://demo.wp-api.org/wp-json/wp/v2/posts/<id>

Postを作成

引数

date

The date the object was published, in the site's timezone.

date_gmt

The date the object was published, as GMT.

slug

An alphanumeric identifier for the object unique to its type.

status

A named status for the object.

次のいずれか: publish, future, draft, pending, private

password

A password to protect access to the content and excerpt.

title

The title for the object.

content

The content for the object.

author

The ID for the author of the object.

excerpt

The excerpt for the object.

featured_media

The ID of the featured media for the object.

comment_status

Whether or not comments are open on the object.

次のいずれか: open, closed

ping_status

Whether or not the object can be pinged.

次のいずれか: open, closed

format

The format for the object.

次のいずれか: standard, aside, chat, gallery, link, image, quote, status, video, audio

meta

Meta fields.

sticky

Whether or not the object should be treated as sticky.

template

The theme file to use to display the object.

categories

The terms assigned to the object in the category taxonomy.

tags

The terms assigned to the object in the post_tag taxonomy.

定義

POST /wp/v2/posts

Postを更新する

引数

id

Unique identifier for the object.

date

The date the object was published, in the site's timezone.

date_gmt

The date the object was published, as GMT.

slug

An alphanumeric identifier for the object unique to its type.

status

A named status for the object.

次のいずれか: publish, future, draft, pending, private

password

A password to protect access to the content and excerpt.

title

The title for the object.

content

The content for the object.

author

The ID for the author of the object.

excerpt

The excerpt for the object.

featured_media

The ID of the featured media for the object.

comment_status

Whether or not comments are open on the object.

次のいずれか: open, closed

ping_status

Whether or not the object can be pinged.

次のいずれか: open, closed

format

The format for the object.

次のいずれか: standard, aside, chat, gallery, link, image, quote, status, video, audio

meta

Meta fields.

sticky

Whether or not the object should be treated as sticky.

template

The theme file to use to display the object.

categories

The terms assigned to the object in the category taxonomy.

tags

The terms assigned to the object in the post_tag taxonomy.

定義

POST /wp/v2/posts/<id>

リクエスト例

$ curl -X POST http://demo.wp-api.org/wp-json -d '{"title":"My New Title"}'

Postを削除

引数

id

Unique identifier for the object.

force

Whether to bypass trash and force deletion.

定義

DELETE /wp/v2/posts/<id>

リクエスト例

$ curl -X DELETE http://demo.wp-api.org/wp-json/wp/v2/posts/<id>