2017-12-08 17:41:48 +00:00
|
|
|
|
# Tainacan Application Programming Interface
|
|
|
|
|
|
|
|
|
|
### Brief Description
|
|
|
|
|
|
|
|
|
|
A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
|
|
|
|
|
|
|
|
|
|
### Routes and Endpoints
|
|
|
|
|
|
|
|
|
|
#### Collections
|
|
|
|
|
|
|
|
|
|
1. Route `wp-json/tainacan/v2/collections/(?P<collection_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
1.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
1.1.1 GET (Fetch a collection)
|
|
|
|
|
|
|
|
|
|
1.1.2 DELETE (Delete or Trash a collection and all your dependencies)
|
2017-12-11 17:05:09 +00:00
|
|
|
|
|
2017-12-08 17:41:48 +00:00
|
|
|
|
```
|
|
|
|
|
To delete pass in body of a requisition the parameter is_permanently as true.
|
|
|
|
|
To only trash pass false.
|
|
|
|
|
```
|
|
|
|
|
2. Route `wp-json/tainacan/v2/collections`
|
|
|
|
|
|
|
|
|
|
2.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
2.1.1 GET (Fetch all collections)
|
|
|
|
|
|
|
|
|
|
2.1.2 POST (Create a collection).
|
2017-12-19 17:27:21 +00:00
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
}
|
|
|
|
|
```
|
2017-12-08 17:41:48 +00:00
|
|
|
|
#### Items
|
|
|
|
|
|
|
|
|
|
1. Route `wp-json/tainacan/v2/items/collection/(?P<collection_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
1.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
1.1.1 GET (Fetch all items from a collection)
|
|
|
|
|
|
|
|
|
|
1.1.2 POST (Create a item in a collection)
|
|
|
|
|
|
2017-12-19 17:27:21 +00:00
|
|
|
|
Example of JSON passed in body for creating a item:
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
{
|
|
|
|
|
"title": "string",
|
|
|
|
|
"description": "string",
|
|
|
|
|
"status": "publish",
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2017-12-08 17:41:48 +00:00
|
|
|
|
2. Route `wp-json/tainacan/v2/items/(?P<item_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
2.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
2.1.1 GET (Fetch a item)
|
|
|
|
|
|
|
|
|
|
2.1.2 DELETE (Delete or Trash a item and all your dependencies)
|
2017-12-11 17:05:09 +00:00
|
|
|
|
|
2017-12-08 17:41:48 +00:00
|
|
|
|
```
|
|
|
|
|
To delete pass in body of a requisition the parameter is_permanently as true.
|
|
|
|
|
To only trash pass false.
|
|
|
|
|
```
|
2017-12-11 17:05:09 +00:00
|
|
|
|
|
|
|
|
|
#### Metadata
|
|
|
|
|
|
|
|
|
|
1. Route `wp-json/tainacan/v2/metadata/collection/(?P<collection_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
1.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
2017-12-19 17:28:30 +00:00
|
|
|
|
```javascript
|
2017-12-11 17:05:09 +00:00
|
|
|
|
{
|
2017-12-19 17:27:21 +00:00
|
|
|
|
"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",
|
|
|
|
|
}
|
2017-12-19 17:28:30 +00:00
|
|
|
|
```
|
2017-12-11 17:05:09 +00:00
|
|
|
|
|
2017-12-12 17:33:36 +00:00
|
|
|
|
1.1.2 GET (Fetch all collection metadata)
|
|
|
|
|
|
2017-12-11 17:05:09 +00:00
|
|
|
|
2. Route `wp-json/tainacan/v2/metadata/item/(?P<item_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
2.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
|
2017-12-19 17:28:30 +00:00
|
|
|
|
```javascript
|
2017-12-11 17:05:09 +00:00
|
|
|
|
{
|
2017-12-19 17:27:21 +00:00
|
|
|
|
"metadata_id": "integer",
|
|
|
|
|
"values": "[any, type]"
|
|
|
|
|
}
|
2017-12-11 17:05:09 +00:00
|
|
|
|
|
2017-12-19 17:28:30 +00:00
|
|
|
|
```
|
2017-12-12 17:33:36 +00:00
|
|
|
|
|
2017-12-19 17:27:21 +00:00
|
|
|
|
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",
|
2017-12-19 17:53:03 +00:00
|
|
|
|
"collections_ids": "array"
|
2017-12-19 17:27:21 +00:00
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Route `wp-json/tainacan/v2/taxonomies/(?P<taxonomy_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
2.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
2.1.1 GET (Fetch a taxonomy)
|
2018-01-08 10:08:03 +00:00
|
|
|
|
|
|
|
|
|
2.1.2 DELETE (Delete or trash a taxonomy)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
To delete pass in body of requisition the parameter is_permanently as true.
|
|
|
|
|
To only trash pass false.
|
|
|
|
|
```
|
2018-01-10 16:05:16 +00:00
|
|
|
|
|
|
|
|
|
#### Filters
|
|
|
|
|
|
|
|
|
|
1. Route `wp-json/tainacan/v2/filters`
|
|
|
|
|
1.1 Endpoints supported:
|
|
|
|
|
|
|
|
|
|
1.1.1 POST (Create a filter)
|
|
|
|
|
|
|
|
|
|
Example of JSON passed in body for creating a filter:
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
{
|
|
|
|
|
"collection_id": "int",
|
|
|
|
|
"metadata_id": "int",
|
2018-01-12 16:02:30 +00:00
|
|
|
|
"filter_type": "string",
|
2018-01-10 16:05:16 +00:00
|
|
|
|
"filter": {
|
|
|
|
|
"name": "string",
|
|
|
|
|
"description": "string",
|
|
|
|
|
...
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
2018-01-15 16:42:44 +00:00
|
|
|
|
|
|
|
|
|
2. Route `wp-json/tainacan/v2/filters/(?P<filter_id>[\d]+)`
|
|
|
|
|
|
|
|
|
|
2.1. Endpoints supported:
|
|
|
|
|
|
|
|
|
|
2.1.1 DELETE (Delete or trash a filter)
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
To delete pass in body of requisition the parameter is_permanently as true.
|
|
|
|
|
To only trash pass false.
|
|
|
|
|
```
|