REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
/**
|
|
|
|
* DO NOT EDIT
|
|
|
|
* Auto-generated by test_build_wp_api_client_fixtures
|
|
|
|
*/
|
2017-02-15 18:58:14 +01:00
|
|
|
var mockedApiResponse = {};
|
|
|
|
/* jshint -W109 */
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.Schema = {
|
|
|
|
"name": "Test Blog",
|
|
|
|
"description": "Just another WordPress site",
|
2017-02-17 01:12:49 +01:00
|
|
|
"url": "http://example.org",
|
|
|
|
"home": "http://example.org",
|
2017-03-07 06:47:32 +01:00
|
|
|
"gmt_offset": "0",
|
|
|
|
"timezone_string": "",
|
2017-02-15 18:58:14 +01:00
|
|
|
"namespaces": [
|
2017-02-17 01:12:49 +01:00
|
|
|
"oembed/1.0",
|
|
|
|
"wp/v2"
|
2017-02-15 18:58:14 +01:00
|
|
|
],
|
|
|
|
"authentication": [],
|
|
|
|
"routes": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"/": {
|
2017-02-15 18:58:14 +01:00
|
|
|
"namespace": "",
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/oembed/1.0": {
|
|
|
|
"namespace": "oembed/1.0",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"namespace": {
|
|
|
|
"required": false,
|
2017-02-17 01:12:49 +01:00
|
|
|
"default": "oembed/1.0"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/oembed/1.0/embed": {
|
|
|
|
"namespace": "oembed/1.0",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"url": {
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"default": "json"
|
|
|
|
},
|
|
|
|
"maxwidth": {
|
|
|
|
"required": false,
|
|
|
|
"default": 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0/embed"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-05-11 20:18:00 +02:00
|
|
|
"/oembed/1.0/proxy": {
|
|
|
|
"namespace": "oembed/1.0",
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"url": {
|
|
|
|
"required": true,
|
|
|
|
"description": "The URL of the resource for which to fetch oEmbed data.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"default": "json",
|
|
|
|
"enum": [
|
|
|
|
"json",
|
|
|
|
"xml"
|
|
|
|
],
|
|
|
|
"description": "The oEmbed format to use.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"maxwidth": {
|
|
|
|
"required": false,
|
|
|
|
"default": 600,
|
|
|
|
"description": "The maximum width of the embed frame in pixels.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"maxheight": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The maximum height of the embed frame in pixels.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"discover": {
|
|
|
|
"required": false,
|
|
|
|
"default": true,
|
|
|
|
"description": "Whether to perform an oEmbed discovery request for non-whitelisted providers.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0/proxy"
|
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"namespace": {
|
|
|
|
"required": false,
|
2017-02-17 01:12:49 +01:00
|
|
|
"default": "wp/v2"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/posts": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"after": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published after a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"author_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"before": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published before a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "desc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "date",
|
|
|
|
"enum": [
|
2017-05-10 20:51:28 +02:00
|
|
|
"author",
|
2017-02-15 18:58:14 +01:00
|
|
|
"date",
|
|
|
|
"id",
|
|
|
|
"include",
|
2017-05-10 20:51:28 +02:00
|
|
|
"modified",
|
|
|
|
"parent",
|
|
|
|
"relevance",
|
|
|
|
"slug",
|
|
|
|
"title"
|
2017-02-15 18:58:14 +01:00
|
|
|
],
|
|
|
|
"description": "Sort collection by object attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to posts with one or more specific slugs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"default": "publish",
|
|
|
|
"description": "Limit result set to posts assigned one or more statuses.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private",
|
|
|
|
"trash",
|
|
|
|
"auto-draft",
|
|
|
|
"inherit",
|
|
|
|
"any"
|
|
|
|
],
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"categories": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items that have the specified term assigned in the categories taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"categories_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items except those that have the specified term assigned in the categories taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items that have the specified term assigned in the tags taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items except those that have the specified term assigned in the tags taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"sticky": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to items that are sticky.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A password to protect access to the content and excerpt.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The excerpt for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"featured_media": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the featured media for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
2017-02-25 05:45:52 +01:00
|
|
|
"standard",
|
|
|
|
"aside",
|
|
|
|
"chat",
|
|
|
|
"gallery",
|
|
|
|
"link",
|
|
|
|
"image",
|
|
|
|
"quote",
|
|
|
|
"status",
|
|
|
|
"video",
|
|
|
|
"audio"
|
2017-02-15 18:58:14 +01:00
|
|
|
],
|
|
|
|
"description": "The format for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"sticky": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Whether or not the object should be treated as sticky.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"categories": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The terms assigned to the object in the category taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The terms assigned to the object in the post_tag taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/posts"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/posts/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The password for the post if it is password protected.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A password to protect access to the content and excerpt.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The excerpt for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"featured_media": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the featured media for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
2017-02-25 05:45:52 +01:00
|
|
|
"standard",
|
|
|
|
"aside",
|
|
|
|
"chat",
|
|
|
|
"gallery",
|
|
|
|
"link",
|
|
|
|
"image",
|
|
|
|
"quote",
|
|
|
|
"status",
|
|
|
|
"video",
|
|
|
|
"audio"
|
2017-02-15 18:58:14 +01:00
|
|
|
],
|
|
|
|
"description": "The format for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"sticky": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Whether or not the object should be treated as sticky.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"categories": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The terms assigned to the object in the category taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"tags": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The terms assigned to the object in the post_tag taxonomy.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to bypass trash and force deletion.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/posts/(?P<parent>[\\d]+)/revisions": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/posts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as revisions do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/pages": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"after": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published after a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"author_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"before": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published before a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"menu_order": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to posts with a specific menu_order value.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "desc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "date",
|
|
|
|
"enum": [
|
2017-05-10 20:51:28 +02:00
|
|
|
"author",
|
2017-02-15 18:58:14 +01:00
|
|
|
"date",
|
|
|
|
"id",
|
|
|
|
"include",
|
2017-05-10 20:51:28 +02:00
|
|
|
"modified",
|
|
|
|
"parent",
|
|
|
|
"relevance",
|
2017-02-15 18:58:14 +01:00
|
|
|
"slug",
|
2017-05-10 20:51:28 +02:00
|
|
|
"title",
|
2017-02-15 18:58:14 +01:00
|
|
|
"menu_order"
|
|
|
|
],
|
|
|
|
"description": "Sort collection by object attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
2017-05-11 20:40:17 +02:00
|
|
|
"description": "Limit result set to items with particular parent IDs.",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parent_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items except those of a particular parent ID.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to posts with one or more specific slugs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"default": "publish",
|
|
|
|
"description": "Limit result set to posts assigned one or more statuses.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private",
|
|
|
|
"trash",
|
|
|
|
"auto-draft",
|
|
|
|
"inherit",
|
|
|
|
"any"
|
|
|
|
],
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A password to protect access to the content and excerpt.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The excerpt for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"featured_media": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the featured media for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"menu_order": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The order of the object in relation to other object of its type.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/pages"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/pages/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The password for the post if it is password protected.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A password to protect access to the content and excerpt.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The excerpt for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"featured_media": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the featured media for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"menu_order": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The order of the object in relation to other object of its type.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to bypass trash and force deletion.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/pages/(?P<parent>[\\d]+)/revisions": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as revisions do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/media": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"after": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published after a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"author_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes posts assigned to specific authors.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"before": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to posts published before a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "desc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "date",
|
|
|
|
"enum": [
|
2017-05-10 20:51:28 +02:00
|
|
|
"author",
|
2017-02-15 18:58:14 +01:00
|
|
|
"date",
|
|
|
|
"id",
|
|
|
|
"include",
|
2017-05-10 20:51:28 +02:00
|
|
|
"modified",
|
|
|
|
"parent",
|
|
|
|
"relevance",
|
|
|
|
"slug",
|
|
|
|
"title"
|
2017-02-15 18:58:14 +01:00
|
|
|
],
|
|
|
|
"description": "Sort collection by object attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
2017-05-11 20:40:17 +02:00
|
|
|
"description": "Limit result set to items with particular parent IDs.",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parent_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to all items except those of a particular parent ID.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to posts with one or more specific slugs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"default": "inherit",
|
|
|
|
"description": "Limit result set to posts assigned one or more statuses.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"enum": [
|
|
|
|
"inherit",
|
|
|
|
"private",
|
|
|
|
"trash"
|
|
|
|
],
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"media_type": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"image",
|
|
|
|
"video",
|
|
|
|
"text",
|
|
|
|
"application",
|
|
|
|
"audio"
|
|
|
|
],
|
|
|
|
"description": "Limit result set to attachments of a particular media type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"mime_type": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to attachments of a particular MIME type.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"alt_text": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Alternative text to display when attachment is not displayed.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"caption": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The attachment caption.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The attachment description.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the associated post of the attachment.",
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/media"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/media/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the object unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"publish",
|
|
|
|
"future",
|
|
|
|
"draft",
|
|
|
|
"pending",
|
|
|
|
"private"
|
|
|
|
],
|
|
|
|
"description": "A named status for the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The title for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the author of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not comments are open on the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Whether or not the object can be pinged.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"template": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
""
|
|
|
|
],
|
|
|
|
"description": "The theme file to use to display the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"alt_text": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Alternative text to display when attachment is not displayed.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"caption": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The attachment caption.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The attachment description.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the associated post of the attachment.",
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to bypass trash and force deletion.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/types": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/types"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/types/(?P<type>[\\w-]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"type": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the post type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/statuses": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/statuses"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/statuses/(?P<status>[\\w-]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the status.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/taxonomies": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"type": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to taxonomies associated with a specific post type.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/taxonomies"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/taxonomies/(?P<taxonomy>[\\w-]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"taxonomy": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the taxonomy.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/categories": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "asc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "name",
|
|
|
|
"enum": [
|
|
|
|
"id",
|
|
|
|
"include",
|
|
|
|
"name",
|
|
|
|
"slug",
|
|
|
|
"term_group",
|
|
|
|
"description",
|
|
|
|
"count"
|
|
|
|
],
|
|
|
|
"description": "Sort collection by term attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"hide_empty": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to hide terms not assigned to any posts.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to terms assigned to a specific parent.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to terms assigned to a specific post.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
2017-04-06 00:24:24 +02:00
|
|
|
"description": "Limit result set to terms with one or more specific slugs.",
|
2017-04-05 22:24:27 +02:00
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML description of the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": true,
|
|
|
|
"description": "HTML title for the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the term unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The parent term ID.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/categories"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/categories/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML description of the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML title for the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the term unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The parent term ID.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as terms do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/tags": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "asc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "name",
|
|
|
|
"enum": [
|
|
|
|
"id",
|
|
|
|
"include",
|
|
|
|
"name",
|
|
|
|
"slug",
|
|
|
|
"term_group",
|
|
|
|
"description",
|
|
|
|
"count"
|
|
|
|
],
|
|
|
|
"description": "Sort collection by term attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"hide_empty": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to hide terms not assigned to any posts.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to terms assigned to a specific post.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
2017-04-06 00:24:24 +02:00
|
|
|
"description": "Limit result set to terms with one or more specific slugs.",
|
2017-04-05 22:24:27 +02:00
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML description of the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": true,
|
|
|
|
"description": "HTML title for the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the term unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/tags"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/tags/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML description of the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "HTML title for the term.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the term unique to its type.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the term.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as terms do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/users": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "asc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "name",
|
|
|
|
"enum": [
|
|
|
|
"id",
|
|
|
|
"include",
|
|
|
|
"name",
|
|
|
|
"registered_date",
|
|
|
|
"slug",
|
|
|
|
"email",
|
|
|
|
"url"
|
|
|
|
],
|
|
|
|
"description": "Sort collection by object attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
2017-04-06 00:24:24 +02:00
|
|
|
"description": "Limit result set to users with one or more specific slugs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"roles": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to users matching at least one specific role provided. Accepts csv list or single role.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"username": {
|
|
|
|
"required": true,
|
|
|
|
"description": "Login name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Display name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"first_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "First name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"last_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Last name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"email": {
|
|
|
|
"required": true,
|
|
|
|
"description": "The email address for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "URL of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Description of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"locale": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"",
|
|
|
|
"en_US",
|
|
|
|
"de_DE",
|
|
|
|
"en_GB",
|
|
|
|
"es_ES"
|
|
|
|
],
|
|
|
|
"description": "Locale for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"nickname": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The nickname for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"roles": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Roles assigned to the user.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": true,
|
|
|
|
"description": "Password for the user (never included).",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/users"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/users/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the user.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the user.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"username": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Login name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Display name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"first_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "First name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"last_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Last name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The email address for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "URL of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Description of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"locale": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"",
|
|
|
|
"en_US",
|
|
|
|
"de_DE",
|
|
|
|
"en_GB",
|
|
|
|
"es_ES"
|
|
|
|
],
|
|
|
|
"description": "Locale for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"nickname": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The nickname for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"roles": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Roles assigned to the user.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Password for the user (never included).",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the user.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as users do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"reassign": {
|
|
|
|
"required": true,
|
|
|
|
"description": "Reassign the deleted user's posts and links to this user ID.",
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/users/me": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"username": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Login name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Display name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"first_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "First name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"last_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Last name for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The email address for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "URL of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Description of the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"locale": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"",
|
|
|
|
"en_US",
|
|
|
|
"de_DE",
|
|
|
|
"en_GB",
|
|
|
|
"es_ES"
|
|
|
|
],
|
|
|
|
"description": "Locale for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"nickname": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The nickname for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"slug": {
|
|
|
|
"required": false,
|
|
|
|
"description": "An alphanumeric identifier for the user.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"roles": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Roles assigned to the user.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Password for the user (never included).",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Required to be true, as users do not support trashing.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"reassign": {
|
|
|
|
"required": true,
|
|
|
|
"description": "Reassign the deleted user's posts and links to this user ID.",
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/users/me"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/comments": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 1,
|
|
|
|
"description": "Current page of the collection.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"per_page": {
|
|
|
|
"required": false,
|
|
|
|
"default": 10,
|
|
|
|
"description": "Maximum number of items to be returned in result set.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"search": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit results to those matching a string.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"after": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to comments published after a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to comments assigned to specific user IDs. Requires authorization.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"author_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Ensure result set excludes comments assigned to specific user IDs. Requires authorization.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"author_email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit result set to that from a specific author email. Requires authorization.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"before": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Limit response to comments published before a given ISO8601 compliant date.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"include": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to specific IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"offset": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Offset the result set by a specific number of items.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"order": {
|
|
|
|
"required": false,
|
|
|
|
"default": "desc",
|
|
|
|
"enum": [
|
|
|
|
"asc",
|
|
|
|
"desc"
|
|
|
|
],
|
|
|
|
"description": "Order sort attribute ascending or descending.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"orderby": {
|
|
|
|
"required": false,
|
|
|
|
"default": "date_gmt",
|
|
|
|
"enum": [
|
|
|
|
"date",
|
|
|
|
"date_gmt",
|
|
|
|
"id",
|
|
|
|
"include",
|
|
|
|
"post",
|
|
|
|
"parent",
|
|
|
|
"type"
|
|
|
|
],
|
|
|
|
"description": "Sort collection by object attribute.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to comments of specific parent IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"parent_exclude": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Ensure result set excludes specific parent IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"default": [],
|
|
|
|
"description": "Limit result set to comments assigned to specific post IDs.",
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "integer"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"default": "approve",
|
|
|
|
"description": "Limit result set to comments assigned a specific status. Requires authorization.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"type": {
|
|
|
|
"required": false,
|
|
|
|
"default": "comment",
|
|
|
|
"description": "Limit result set to comments assigned a specific type. Requires authorization.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The password for the post if it is password protected.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the user object, if author was a user.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"author_email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Email address for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_ip": {
|
|
|
|
"required": false,
|
|
|
|
"description": "IP address for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Display name for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "URL for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_user_agent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "User agent for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"default": 0,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"default": 0,
|
|
|
|
"description": "The ID of the associated post object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"description": "State of the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/comments"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/comments/(?P<id>[\\d]+)": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH",
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view",
|
|
|
|
"enum": [
|
|
|
|
"view",
|
|
|
|
"embed",
|
|
|
|
"edit"
|
|
|
|
],
|
|
|
|
"description": "Scope under which the request is made; determines fields present in response.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
2017-05-11 20:40:17 +02:00
|
|
|
"description": "The password for the parent post of the comment (if the post is password protected).",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"author": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the user object, if author was a user.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"author_email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Email address for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_ip": {
|
|
|
|
"required": false,
|
|
|
|
"description": "IP address for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_name": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Display name for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "URL for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"author_user_agent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "User agent for the object author.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The content for the object.",
|
|
|
|
"type": "object"
|
|
|
|
},
|
|
|
|
"date": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, in the site's timezone.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_gmt": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The date the object was published, as GMT.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"parent": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID for the parent of the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"post": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The ID of the associated post object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"status": {
|
|
|
|
"required": false,
|
|
|
|
"description": "State of the object.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"meta": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Meta fields.",
|
|
|
|
"type": "object"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"DELETE"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"id": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Unique identifier for the object.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"force": {
|
|
|
|
"required": false,
|
|
|
|
"default": false,
|
|
|
|
"description": "Whether to bypass trash and force deletion.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"required": false,
|
2017-05-11 20:40:17 +02:00
|
|
|
"description": "The password for the parent post of the comment (if the post is password protected).",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/wp/v2/settings": {
|
|
|
|
"namespace": "wp/v2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET",
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"POST",
|
|
|
|
"PUT",
|
|
|
|
"PATCH"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"title": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Site title.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"description": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Site tagline.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"url": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Site URL.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"email": {
|
|
|
|
"required": false,
|
|
|
|
"description": "This address is used for admin purposes, like new user notification.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"timezone": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A city in the same timezone as you.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"date_format": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A date format for all date strings.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"time_format": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A time format for all time strings.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"start_of_week": {
|
|
|
|
"required": false,
|
|
|
|
"description": "A day number of the week that the week should start on.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"language": {
|
|
|
|
"required": false,
|
|
|
|
"description": "WordPress locale code.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"use_smilies": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Convert emoticons like :-) and :-P to graphics on display.",
|
|
|
|
"type": "boolean"
|
|
|
|
},
|
|
|
|
"default_category": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Default post category.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"default_post_format": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Default post format.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"posts_per_page": {
|
|
|
|
"required": false,
|
|
|
|
"description": "Blog pages show at most.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"default_ping_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"default_comment_status": {
|
|
|
|
"required": false,
|
|
|
|
"enum": [
|
|
|
|
"open",
|
|
|
|
"closed"
|
|
|
|
],
|
|
|
|
"description": "Allow people to post comments on new articles.",
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/wp/v2/settings"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.oembed = {
|
2017-02-17 01:12:49 +01:00
|
|
|
"namespace": "oembed/1.0",
|
2017-02-15 18:58:14 +01:00
|
|
|
"routes": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"/oembed/1.0": {
|
|
|
|
"namespace": "oembed/1.0",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"namespace": {
|
|
|
|
"required": false,
|
2017-02-17 01:12:49 +01:00
|
|
|
"default": "oembed/1.0"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"context": {
|
|
|
|
"required": false,
|
|
|
|
"default": "view"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"/oembed/1.0/embed": {
|
|
|
|
"namespace": "oembed/1.0",
|
2017-02-15 18:58:14 +01:00
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"url": {
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"default": "json"
|
|
|
|
},
|
|
|
|
"maxwidth": {
|
|
|
|
"required": false,
|
|
|
|
"default": 600
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0/embed"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
2017-05-11 20:18:00 +02:00
|
|
|
},
|
|
|
|
"/oembed/1.0/proxy": {
|
|
|
|
"namespace": "oembed/1.0",
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"endpoints": [
|
|
|
|
{
|
|
|
|
"methods": [
|
|
|
|
"GET"
|
|
|
|
],
|
|
|
|
"args": {
|
|
|
|
"url": {
|
|
|
|
"required": true,
|
|
|
|
"description": "The URL of the resource for which to fetch oEmbed data.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"format": {
|
|
|
|
"required": false,
|
|
|
|
"default": "json",
|
|
|
|
"enum": [
|
|
|
|
"json",
|
|
|
|
"xml"
|
|
|
|
],
|
|
|
|
"description": "The oEmbed format to use.",
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"maxwidth": {
|
|
|
|
"required": false,
|
|
|
|
"default": 600,
|
|
|
|
"description": "The maximum width of the embed frame in pixels.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"maxheight": {
|
|
|
|
"required": false,
|
|
|
|
"description": "The maximum height of the embed frame in pixels.",
|
|
|
|
"type": "integer"
|
|
|
|
},
|
|
|
|
"discover": {
|
|
|
|
"required": false,
|
|
|
|
"default": true,
|
|
|
|
"description": "Whether to perform an oEmbed discovery request for non-whitelisted providers.",
|
|
|
|
"type": "boolean"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"_links": {
|
|
|
|
"self": "http://example.org/?rest_route=/oembed/1.0/proxy"
|
|
|
|
}
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.oembeds = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"version": "1.0",
|
|
|
|
"provider_name": "Test Blog",
|
|
|
|
"provider_url": "http://example.org",
|
|
|
|
"author_name": "Test Blog",
|
|
|
|
"author_url": "http://example.org",
|
|
|
|
"title": "REST API Client Fixture: Post",
|
|
|
|
"type": "rich",
|
|
|
|
"width": 600,
|
|
|
|
"height": 338,
|
|
|
|
"html": "<blockquote class=\"wp-embedded-content\">...</blockquote>"
|
2017-02-15 18:58:14 +01:00
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-05-11 20:18:00 +02:00
|
|
|
mockedApiResponse.oembedProxy = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"version": "1.0",
|
|
|
|
"type": "video",
|
|
|
|
"provider_name": "YouTube",
|
|
|
|
"provider_url": "https://www.youtube.com",
|
|
|
|
"thumbnail_width": 480,
|
|
|
|
"width": 500,
|
|
|
|
"thumbnail_height": 360,
|
|
|
|
"html": "<iframe width=\"500\" height=\"375\" src=\"https://www.youtube.com/embed/i_cVJgIz_Cs?feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>",
|
|
|
|
"author_name": "Jorge Rubira Santos",
|
|
|
|
"thumbnail_url": "https://i.ytimg.com/vi/i_cVJgIz_Cs/hqdefault.jpg",
|
|
|
|
"title": "No te olvides de poner el Where en el Delete From. (Una cancion para programadores)",
|
|
|
|
"height": 375
|
2017-05-11 20:18:00 +02:00
|
|
|
};
|
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.PostsCollection = [
|
|
|
|
{
|
|
|
|
"id": 3,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?p=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-post",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "publish",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "post",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?p=3",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Post"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated post content.</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Post</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"featured_media": 0,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "open",
|
|
|
|
"sticky": false,
|
|
|
|
"template": "",
|
|
|
|
"format": "standard",
|
|
|
|
"meta": [],
|
|
|
|
"categories": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"tags": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts/3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"about": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types/post"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"replies": [
|
|
|
|
{
|
|
|
|
"embeddable": true,
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fcomments&post=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"version-history": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts/3/revisions"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:attachment": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:term": [
|
|
|
|
{
|
|
|
|
"taxonomy": "category",
|
|
|
|
"embeddable": true,
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fcategories&post=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"taxonomy": "post_tag",
|
|
|
|
"embeddable": true,
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Ftags&post=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.PostModel = {
|
|
|
|
"id": 3,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?p=3"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-post",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "publish",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "post",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?p=3",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Post"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated post content.</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Post</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"featured_media": 0,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "open",
|
|
|
|
"sticky": false,
|
|
|
|
"template": "",
|
|
|
|
"format": "standard",
|
|
|
|
"meta": [],
|
|
|
|
"categories": [
|
|
|
|
1
|
|
|
|
],
|
|
|
|
"tags": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.postRevisions = [
|
|
|
|
{
|
2017-05-11 20:31:26 +02:00
|
|
|
"author": 2,
|
2017-02-15 18:58:14 +01:00
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"id": 4,
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"parent": 3,
|
|
|
|
"slug": "3-revision-v1",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?p=4"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Post"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated post content.</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Post</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"_links": {
|
|
|
|
"parent": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts/3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.revision = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"author": 2,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"id": 4,
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"parent": 3,
|
|
|
|
"slug": "3-revision-v1",
|
|
|
|
"guid": {
|
|
|
|
"rendered": "http://example.org/?p=4"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Post"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"rendered": "<p>Updated post content.</p>\n"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"rendered": "<p>REST API Client Fixture: Post</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.PagesCollection = [
|
|
|
|
{
|
|
|
|
"id": 5,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?page_id=5"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-page",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "publish",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "page",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?page_id=5",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Page"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated page content.</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Page</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"featured_media": 0,
|
|
|
|
"parent": 0,
|
|
|
|
"menu_order": 0,
|
|
|
|
"comment_status": "closed",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/pages/5"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/pages"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"about": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types/page"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"replies": [
|
|
|
|
{
|
|
|
|
"embeddable": true,
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fcomments&post=5"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"version-history": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/pages/5/revisions"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:attachment": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.PageModel = {
|
|
|
|
"id": 5,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?page_id=5"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-page",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "publish",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "page",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?page_id=5",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Page"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated page content.</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Page</p>\n",
|
2017-02-15 18:58:14 +01:00
|
|
|
"protected": false
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"featured_media": 0,
|
|
|
|
"parent": 0,
|
|
|
|
"menu_order": 0,
|
|
|
|
"comment_status": "closed",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"meta": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.pageRevisions = [
|
|
|
|
{
|
2017-05-11 20:31:26 +02:00
|
|
|
"author": 2,
|
2017-02-15 18:58:14 +01:00
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"id": 6,
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"parent": 5,
|
|
|
|
"slug": "5-revision-v1",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?p=6"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Page"
|
|
|
|
},
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>Updated page content.</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"excerpt": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>REST API Client Fixture: Page</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"_links": {
|
|
|
|
"parent": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/pages/5"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.pageRevision = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"author": 2,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"id": 6,
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"parent": 5,
|
|
|
|
"slug": "5-revision-v1",
|
|
|
|
"guid": {
|
|
|
|
"rendered": "http://example.org/?p=6"
|
|
|
|
},
|
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Page"
|
|
|
|
},
|
|
|
|
"content": {
|
|
|
|
"rendered": "<p>Updated page content.</p>\n"
|
|
|
|
},
|
|
|
|
"excerpt": {
|
|
|
|
"rendered": "<p>REST API Client Fixture: Page</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.MediaCollection = [
|
|
|
|
{
|
|
|
|
"id": 7,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?attachment_id=7"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-attachment",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "inherit",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "attachment",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?attachment_id=7",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Attachment"
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"meta": [],
|
|
|
|
"description": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p class=\"attachment\"><a href='http://example.org/wp-content/uploads//tmp/canola.jpg'><img width=\"1\" height=\"1\" src=\"http://example.org/wp-content/uploads//tmp/canola.jpg\" class=\"attachment-medium size-medium\" alt=\"\" /></a></p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"caption": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>A sample caption</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"alt_text": "",
|
|
|
|
"media_type": "image",
|
2017-02-17 01:12:49 +01:00
|
|
|
"mime_type": "image/jpeg",
|
2017-02-15 18:58:14 +01:00
|
|
|
"media_details": {},
|
|
|
|
"post": null,
|
2017-02-17 01:12:49 +01:00
|
|
|
"source_url": "http://example.org/wp-content/uploads//tmp/canola.jpg",
|
2017-02-15 18:58:14 +01:00
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/media/7"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/media"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"about": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types/attachment"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"replies": [
|
|
|
|
{
|
|
|
|
"embeddable": true,
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.MediaModel = {
|
|
|
|
"id": 7,
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"guid": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "http://example.org/?attachment_id=7"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"modified": "2017-02-14T00:00:00",
|
|
|
|
"modified_gmt": "2017-02-14T00:00:00",
|
|
|
|
"slug": "restapi-client-fixture-attachment",
|
2017-02-19 05:31:12 +01:00
|
|
|
"status": "inherit",
|
2017-02-15 18:58:14 +01:00
|
|
|
"type": "attachment",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?attachment_id=7",
|
2017-02-15 18:58:14 +01:00
|
|
|
"title": {
|
|
|
|
"rendered": "REST API Client Fixture: Attachment"
|
|
|
|
},
|
|
|
|
"author": 0,
|
|
|
|
"comment_status": "open",
|
|
|
|
"ping_status": "closed",
|
|
|
|
"template": "",
|
|
|
|
"meta": [],
|
|
|
|
"description": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p class=\"attachment\"><a href='http://example.org/wp-content/uploads//tmp/canola.jpg'><img width=\"1\" height=\"1\" src=\"http://example.org/wp-content/uploads//tmp/canola.jpg\" class=\"attachment-medium size-medium\" alt=\"\" /></a></p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"caption": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>A sample caption</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"alt_text": "",
|
|
|
|
"media_type": "image",
|
2017-02-17 01:12:49 +01:00
|
|
|
"mime_type": "image/jpeg",
|
2017-02-15 18:58:14 +01:00
|
|
|
"media_details": {},
|
|
|
|
"post": null,
|
2017-02-17 01:12:49 +01:00
|
|
|
"source_url": "http://example.org/wp-content/uploads//tmp/canola.jpg"
|
2017-02-15 18:58:14 +01:00
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TypesCollection = {
|
|
|
|
"post": {
|
|
|
|
"description": "",
|
|
|
|
"hierarchical": false,
|
|
|
|
"name": "Posts",
|
|
|
|
"slug": "post",
|
|
|
|
"taxonomies": [
|
|
|
|
"category",
|
|
|
|
"post_tag"
|
|
|
|
],
|
|
|
|
"rest_base": "posts",
|
|
|
|
"_links": {
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:items": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"page": {
|
|
|
|
"description": "",
|
|
|
|
"hierarchical": true,
|
|
|
|
"name": "Pages",
|
|
|
|
"slug": "page",
|
|
|
|
"taxonomies": [],
|
|
|
|
"rest_base": "pages",
|
|
|
|
"_links": {
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:items": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/pages"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"attachment": {
|
|
|
|
"description": "",
|
|
|
|
"hierarchical": false,
|
|
|
|
"name": "Media",
|
|
|
|
"slug": "attachment",
|
|
|
|
"taxonomies": [],
|
|
|
|
"rest_base": "media",
|
|
|
|
"_links": {
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/types"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:items": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/media"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TypeModel = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"description": "",
|
|
|
|
"hierarchical": false,
|
|
|
|
"name": "Posts",
|
|
|
|
"slug": "post",
|
|
|
|
"taxonomies": [
|
|
|
|
"category",
|
|
|
|
"post_tag"
|
|
|
|
],
|
|
|
|
"rest_base": "posts"
|
2017-02-15 18:58:14 +01:00
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.StatusesCollection = {
|
|
|
|
"publish": {
|
|
|
|
"name": "Published",
|
|
|
|
"public": true,
|
|
|
|
"queryable": true,
|
|
|
|
"slug": "publish",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"future": {
|
|
|
|
"name": "Scheduled",
|
|
|
|
"public": false,
|
|
|
|
"queryable": false,
|
|
|
|
"slug": "future",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&status=future"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"draft": {
|
|
|
|
"name": "Draft",
|
|
|
|
"public": false,
|
|
|
|
"queryable": false,
|
|
|
|
"slug": "draft",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&status=draft"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"pending": {
|
|
|
|
"name": "Pending",
|
|
|
|
"public": false,
|
|
|
|
"queryable": false,
|
|
|
|
"slug": "pending",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&status=pending"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"private": {
|
|
|
|
"name": "Private",
|
|
|
|
"public": false,
|
|
|
|
"queryable": false,
|
|
|
|
"slug": "private",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&status=private"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"trash": {
|
|
|
|
"name": "Trash",
|
|
|
|
"public": false,
|
|
|
|
"queryable": false,
|
|
|
|
"slug": "trash",
|
|
|
|
"_links": {
|
|
|
|
"archives": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&status=trash"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.StatusModel = {
|
|
|
|
"name": "Published",
|
|
|
|
"public": true,
|
|
|
|
"queryable": true,
|
|
|
|
"slug": "publish"
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TaxonomiesCollection = {
|
|
|
|
"category": {
|
|
|
|
"name": "Categories",
|
|
|
|
"slug": "category",
|
|
|
|
"description": "",
|
|
|
|
"types": [
|
|
|
|
"post"
|
|
|
|
],
|
|
|
|
"hierarchical": true,
|
|
|
|
"rest_base": "categories",
|
|
|
|
"_links": {
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/taxonomies"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:items": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/categories"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"post_tag": {
|
|
|
|
"name": "Tags",
|
|
|
|
"slug": "post_tag",
|
|
|
|
"description": "",
|
|
|
|
"types": [
|
|
|
|
"post"
|
|
|
|
],
|
|
|
|
"hierarchical": false,
|
|
|
|
"rest_base": "tags",
|
|
|
|
"_links": {
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/taxonomies"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:items": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/tags"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TaxonomyModel = {
|
|
|
|
"name": "Categories",
|
|
|
|
"slug": "category",
|
|
|
|
"description": "",
|
|
|
|
"types": [
|
|
|
|
"post"
|
|
|
|
],
|
|
|
|
"hierarchical": true,
|
|
|
|
"rest_base": "categories"
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.CategoriesCollection = [
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"count": 1,
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?cat=1",
|
2017-02-15 18:58:14 +01:00
|
|
|
"name": "Uncategorized",
|
|
|
|
"slug": "uncategorized",
|
|
|
|
"taxonomy": "category",
|
|
|
|
"parent": 0,
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/categories/1"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/categories"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"about": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/taxonomies/category"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:post_type": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&categories=1"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.CategoryModel = {
|
|
|
|
"id": 1,
|
|
|
|
"count": 1,
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?cat=1",
|
2017-02-15 18:58:14 +01:00
|
|
|
"name": "Uncategorized",
|
|
|
|
"slug": "uncategorized",
|
|
|
|
"taxonomy": "category",
|
|
|
|
"parent": 0,
|
|
|
|
"meta": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TagsCollection = [
|
|
|
|
{
|
|
|
|
"id": 2,
|
|
|
|
"count": 0,
|
|
|
|
"description": "REST API Client Fixture: Tag",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?tag=restapi-client-fixture-tag",
|
2017-02-15 18:58:14 +01:00
|
|
|
"name": "REST API Client Fixture: Tag",
|
|
|
|
"slug": "restapi-client-fixture-tag",
|
|
|
|
"taxonomy": "post_tag",
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/tags/2"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/tags"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"about": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/taxonomies/post_tag"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"wp:post_type": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=%2Fwp%2Fv2%2Fposts&tags=2"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"curies": [
|
|
|
|
{
|
|
|
|
"name": "wp",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "https://api.w.org/{rel}",
|
2017-02-15 18:58:14 +01:00
|
|
|
"templated": true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.TagModel = {
|
|
|
|
"id": 2,
|
|
|
|
"count": 0,
|
|
|
|
"description": "REST API Client Fixture: Tag",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?tag=restapi-client-fixture-tag",
|
2017-02-15 18:58:14 +01:00
|
|
|
"name": "REST API Client Fixture: Tag",
|
|
|
|
"slug": "restapi-client-fixture-tag",
|
|
|
|
"taxonomy": "post_tag",
|
|
|
|
"meta": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.UsersCollection = [
|
|
|
|
{
|
|
|
|
"id": 1,
|
|
|
|
"name": "admin",
|
|
|
|
"url": "",
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?author=1",
|
2017-02-15 18:58:14 +01:00
|
|
|
"slug": "admin",
|
|
|
|
"avatar_urls": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"24": "http://0.gravatar.com/avatar/96614ec98aa0c0d2ee75796dced6df54?s=24&d=mm&r=g",
|
|
|
|
"48": "http://0.gravatar.com/avatar/96614ec98aa0c0d2ee75796dced6df54?s=48&d=mm&r=g",
|
|
|
|
"96": "http://0.gravatar.com/avatar/96614ec98aa0c0d2ee75796dced6df54?s=96&d=mm&r=g"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/users/1"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/users"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 2,
|
|
|
|
"name": "REST API Client Fixture: User",
|
|
|
|
"url": "",
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?author=2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"slug": "restapiclientfixtureuser",
|
|
|
|
"avatar_urls": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"24": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=24&d=mm&r=g",
|
|
|
|
"48": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=48&d=mm&r=g",
|
|
|
|
"96": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=96&d=mm&r=g"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/users/2"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/users"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.UserModel = {
|
|
|
|
"id": 2,
|
|
|
|
"name": "REST API Client Fixture: User",
|
|
|
|
"url": "",
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?author=2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"slug": "restapiclientfixtureuser",
|
|
|
|
"avatar_urls": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"24": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=24&d=mm&r=g",
|
|
|
|
"48": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=48&d=mm&r=g",
|
|
|
|
"96": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=96&d=mm&r=g"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"meta": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.me = {
|
|
|
|
"id": 2,
|
|
|
|
"name": "REST API Client Fixture: User",
|
|
|
|
"url": "",
|
|
|
|
"description": "",
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?author=2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"slug": "restapiclientfixtureuser",
|
|
|
|
"avatar_urls": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"24": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=24&d=mm&r=g",
|
|
|
|
"48": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=48&d=mm&r=g",
|
|
|
|
"96": "http://2.gravatar.com/avatar/57cbd982c963c7eb2294e2eee1b4448e?s=96&d=mm&r=g"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"meta": []
|
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.CommentsCollection = [
|
|
|
|
{
|
|
|
|
"id": 2,
|
|
|
|
"post": 3,
|
|
|
|
"parent": 0,
|
|
|
|
"author": 0,
|
|
|
|
"author_name": "Internet of something or other",
|
2017-02-17 01:12:49 +01:00
|
|
|
"author_url": "http://lights.example.org/",
|
2017-02-15 18:58:14 +01:00
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"content": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"rendered": "<p>This is a comment</p>\n"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
2017-02-17 01:12:49 +01:00
|
|
|
"link": "http://example.org/?p=3#comment-2",
|
2017-02-15 18:58:14 +01:00
|
|
|
"status": "approved",
|
|
|
|
"type": "comment",
|
|
|
|
"author_avatar_urls": {
|
2017-02-17 01:12:49 +01:00
|
|
|
"24": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=24&d=mm&r=g",
|
|
|
|
"48": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=48&d=mm&r=g",
|
|
|
|
"96": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=96&d=mm&r=g"
|
2017-02-15 18:58:14 +01:00
|
|
|
},
|
|
|
|
"meta": [],
|
|
|
|
"_links": {
|
|
|
|
"self": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/comments/2"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"collection": [
|
|
|
|
{
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/comments"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"up": [
|
|
|
|
{
|
|
|
|
"embeddable": true,
|
|
|
|
"post_type": "post",
|
2017-02-17 01:12:49 +01:00
|
|
|
"href": "http://example.org/?rest_route=/wp/v2/posts/3"
|
2017-02-15 18:58:14 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.CommentModel = {
|
2017-05-11 20:31:26 +02:00
|
|
|
"id": 2,
|
|
|
|
"post": 3,
|
|
|
|
"parent": 0,
|
|
|
|
"author": 0,
|
|
|
|
"author_name": "Internet of something or other",
|
|
|
|
"author_url": "http://lights.example.org/",
|
|
|
|
"date": "2017-02-14T00:00:00",
|
|
|
|
"date_gmt": "2017-02-14T00:00:00",
|
|
|
|
"content": {
|
|
|
|
"rendered": "<p>This is a comment</p>\n"
|
|
|
|
},
|
|
|
|
"link": "http://example.org/?p=3#comment-2",
|
|
|
|
"status": "approved",
|
|
|
|
"type": "comment",
|
|
|
|
"author_avatar_urls": {
|
|
|
|
"24": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=24&d=mm&r=g",
|
|
|
|
"48": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=48&d=mm&r=g",
|
|
|
|
"96": "http://2.gravatar.com/avatar/bd7c2b505bcf39cc71cfee564c614956?s=96&d=mm&r=g"
|
|
|
|
},
|
|
|
|
"meta": []
|
2017-02-15 18:58:14 +01:00
|
|
|
};
|
REST API: Add QUnit tests for wp-api.js and PHPUnit fixture generation.
Add QUnit tests: verify that wp-api loads correctly, verify that the expected base models and collections exist and can be instantiated, verify that collections contain the correct models, verify that expected helper functions are in place for each collection.
The QUnit tests rely on two fixture files: `tests/qunit/fixtures/wp-api-generated.js` contains the data response from each core endpoint and is generated by running the PHPUnit `restapi-jsclient` group. `tests/qunit/fixtures/wp-api.js` maps the generated data to endpoint routes, and overrides `Backbone.ajax` to mock the responses for the tests.
Add PHPUnit tests in `tests/phpunit/tests/rest-api/rest-schema-setup.php`. First, verify that the API returns the expected routes via `server->get_routes()`. Then, the `test_build_wp_api_client_fixtures` test goes thru each endpoint and requests it from the API, tests that it returns data, and builds up the data for the mocked QUnit tests, saving the final results to `tests/qunit/fixtures/wp-api-generated.js`.
Add a new grunt task `restapi-jsclient` which runs the phpunit side data generation and the qunit tests together.
Props jnylen0, welcher.
Fixes #39264.
git-svn-id: https://develop.svn.wordpress.org/trunk@40058 602fd350-edb4-49c9-b593-d223f7449a82
2017-02-14 05:22:32 +01:00
|
|
|
|
2017-02-15 18:58:14 +01:00
|
|
|
mockedApiResponse.settings = {
|
|
|
|
"title": "Test Blog",
|
|
|
|
"description": "Just another WordPress site",
|
2017-02-17 01:12:49 +01:00
|
|
|
"url": "http://example.org",
|
2017-02-15 18:58:14 +01:00
|
|
|
"email": "admin@example.org",
|
|
|
|
"timezone": "",
|
|
|
|
"date_format": "F j, Y",
|
|
|
|
"time_format": "g:i a",
|
|
|
|
"start_of_week": 1,
|
|
|
|
"language": "en_US",
|
|
|
|
"use_smilies": true,
|
|
|
|
"default_category": 1,
|
|
|
|
"default_post_format": "0",
|
|
|
|
"posts_per_page": 10,
|
|
|
|
"default_ping_status": "open",
|
|
|
|
"default_comment_status": "open"
|
|
|
|
};
|