スキーマ

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

id
integer

Unique identifier for the resource.

読み取り専用

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

count
integer

Number of published posts for the resource.

読み取り専用

コンテキスト: view, edit

description
string

HTML description of the resource.

コンテキスト: view, edit

name
string

HTML title for the resource.

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

slug
string

An alphanumeric identifier for the resource unique to its type.

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

taxonomy
string

Type attribution for the resource.

読み取り専用

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

次のいずれか: category, post_tag, nav_menu, link_category, post_format

parent
integer

The id for the parent of the resource.

コンテキスト: view, edit

Example Request

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

Category一覧

引数

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.

exclude

Ensure result set excludes specific ids.

初期値:

include

Limit result set to specific ids.

初期値:

order

Order sort attribute ascending or descending.

初期値: asc

次のいずれか: asc, desc

orderby

Sort collection by resource attribute.

初期値: name

次のいずれか: id, include, name, slug, term_group, description, count

hide_empty

Whether to hide resources not assigned to any posts.

parent

Limit result set to resources assigned to a specific parent.

post

Limit result set to resources assigned to a specific post.

slug

Limit result set to resources with a specific slug.

定義

GET /wp/v2/categories

リクエスト例

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

Categoryを取得する

引数

context

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

初期値: view

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

定義

GET /wp/v2/categories/<id>

リクエスト例

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

Categoryを作成

引数

description

HTML description of the resource.

name

HTML title for the resource.

必須: true

slug

An alphanumeric identifier for the resource unique to its type.

parent

The id for the parent of the resource.

定義

POST /wp/v2/categories

Categoryを更新する

引数

description

HTML description of the resource.

name

HTML title for the resource.

slug

An alphanumeric identifier for the resource unique to its type.

parent

The id for the parent of the resource.

定義

POST /wp/v2/categories/<id>

リクエスト例

Categoryを削除

引数

force

Required to be true, as resource does not support trashing.

定義

DELETE /wp/v2/categories/<id>

リクエスト例

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