Update tainacan-api.md

This commit is contained in:
Weryques 2017-12-19 15:27:21 -02:00 committed by GitHub
parent 167867620e
commit bf4feb6ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 74 additions and 13 deletions

View File

@ -27,7 +27,23 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
2.1.1 GET (Fetch all collections)
2.1.2 POST (Create a collection).
Example of JSON passed in body for creating a collection:
```javascript
{
  "name": "string",
   "description": "string",
   "status": "publish",
   "order": "string",
   "parent": "integer",
   "slug": "string",
   "default_orderby": "string",
   "default_order": "string",
   "columns": "string",
   "default_view_mode": "string"
 }
```
#### Items
1. Route `wp-json/tainacan/v2/items/collection/(?P<collection_id>[\d]+)`
@ -38,6 +54,16 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
1.1.2 POST (Create a item in a collection)
Example of JSON passed in body for creating a item:
```javascript
{
  "title": "string",
   "description": "string",
   "status": "publish",
 }
```
2. Route `wp-json/tainacan/v2/items/(?P<item_id>[\d]+)`
2.1. Endpoints supported:
@ -59,16 +85,24 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
1.1.1 POST (Create a metadata in collection and all your items)
```
In body of requisition pass a JSON with the attributes of metadata like:
```
```javascript
{
name: '',
description: '',
field_type: ''
}
      "name": "string",
      "description": "string",
      "field_type": "string",
      "order": "string",
      "parent": "integer",
      "required": "string",
      "collection_key": "string",
      "multiple": "string",
      "cardinality": "string",
      "privacy": "string",
      "mask": "string",
      "default_value": "string",
      "field_type_options": "string",
   }
```
1.1.2 GET (Fetch all collection metadata)
@ -79,16 +113,43 @@ A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
2.1.1 POST (Set a value of item metadata)
```
In body of requisition pass a JSON with value e and id of metadata like:
```
```javascript
{
metadata_id: '',
values: ''
}
      "metadata_id": "integer",
      "values": "[any, type]"
   }
```
2.1.2 GET (Fetch all item metadata, with your values)
2.1.2 GET (Fetch all item metadata, with your values)
#### Taxonomies
1. Route `wp-json/tainacan/v2/taxonomies`
1.1. Endpoints supported:
1.1.1. GET (Fetch all taxonomies)
1.1.2. POST (Create a taxonomy)
Example of JSON passed in body for creating a taxonomy:
```javascript
{
  "name": "string",
   "description": "string",
   "status": "publish",
   "parent": "string",
   "slug": "string",
   "allow_insert": "string",
 }
```
2. Route `wp-json/tainacan/v2/taxonomies/(?P<taxonomy_id>[\d]+)`
2.1. Endpoints supported:
2.1.1 GET (Fetch a taxonomy)