8.5 KiB
Tainacan Application Programming Interface
Brief Description
A REST API for Tainacan Plugin. This API uses the Wordpress REST API.
Routes and Endpoints
Summary
Collections
-
Route
wp-json/tainacan/v2/collections/(?P<collection_id>[\d]+)
-
Endpoints supported:
-
GET (Fetch a collection)
-
DELETE (Delete or Trash a collection and all your dependencies)
To delete pass in body of a requisition the parameter
is_permanently
as true. To only trash pass false. -
PATCH or PUT (Update a collection)
Example of JSON passed in body for updating a collection:
-
-
{
"name": "string",
"description": "string",
...
}
-
Route
wp-json/tainacan/v2/collections
-
Endpoints supported:
-
GET (Fetch all collections)
-
POST (Create a collection).
Example of JSON passed in body for creating a collection:
-
-
{
"name": "string",
"description": "string",
"status": "string",
"order": "string",
"parent": "integer",
"slug": "string",
"default_orderby": "string",
"default_order": "string",
"columns": "string",
"default_view_mode": "string"
}
Items
-
Route
wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/items
-
Endpoints supported:
-
GET (Fetch all items from a collection)
-
POST (Create a item in a collection)
Example of JSON passed in body for creating a item:
-
-
{
"title": "string",
"description": "string",
"status": "string",
"terms": ["integer", "integer", ...]
}
-
Route
wp-json/tainacan/v2/items/(?P<item_id>[\d]+)
-
Endpoints supported:
-
GET (Fetch a item)
-
DELETE (Delete or Trash a item and all your dependencies)
To delete pass in body of a requisition the parameter is_permanently as true. To only trash pass false.
-
PATCH or PUT (Update a item)
Example of JSON passed in body for updating a item:
-
-
{
"title": "string",
"description": "string",
"terms": ["integer", "integer", ...]
...
}
Fields
-
Route
wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/fields
- Endpoints supported:
-
GET (Fetch all collection field)
-
POST (Create a field in collection and all it items)
In body of requisition pass a JSON with the attributes of field like:
-
- Endpoints supported:
{
"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",
}
-
Route
wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/fields/(?P<field_id>[\d]+)
-
Endpoints supported:
-
PATCH or PUT (Update a field in a collection and all it items)
In body of requisition pass a JSON with the attributes you need to update, like:
-
-
{
"name": "string",
"description": "string",
}
Field Types
-
Route
wp-json/tainacan/v2/field-types
-
Endpoint supported:
- GET (Fetch all field types)
-
Item Metadata
-
Route
wp-json/tainacan/v2/item/(?P<item_id>[\d]+)/metadata/(?P<metadata_id>[\d]+)
-
Endpoints supported:
-
PATCH or PUT (Set value of a metadata)
In body of requisition pass a JSON with values of metadata, like:
-
-
{
"values": ["any", "type"]
}
-
Route
wp-json/tainacan/v2/item/(?P<item_id>[\d]+)/metadata
-
Enpoints supported:
- GET (Fetch all item metadata, with it values)
-
Taxonomies
-
Route
wp-json/tainacan/v2/taxonomies
-
Endpoints supported:
-
GET (Fetch all taxonomies)
-
POST (Create a taxonomy)
Example of JSON passed in body for creating a taxonomy:
-
-
{
"name": "string",
"description": "string",
"status": "string",
"parent": "string",
"slug": "string",
"allow_insert": "string",
"collections_ids": "array"
}
-
Route
wp-json/tainacan/v2/taxonomies/(?P<taxonomy_id>[\d]+)
-
Endpoints supported:
-
GET (Fetch a taxonomy)
-
DELETE (Delete or trash a taxonomy)
To delete pass in body of requisition the parameter is_permanently as true. To only trash pass false.
-
PATCH or PUT (Update a taxonomy)
Example of JSON passed in body for updating a taxonomy:
-
-
{
"name": "string",
"description": "string",
...
}
-
Route
wp-json/tainacan/v2/taxonomies/(?P<taxonomy_id>[\d]+)/collection/(?P<collection_id>[\d]+)
-
Routes supported:
- PATCH or PUT (Add a Collection in a Taxonomy)
-
Filters
-
Route
wp-json/tainacan/v2/collection/(?P<collection_id>[\d]+)/field/(?P<field_id>[\d]+)/filters
-
Endpoints supported:
-
POST (Create a filter)
Example of JSON passed in body for creating a filter:
-
-
{
"filter_type": "string",
"filter": {
"name": "string",
"description": "string",
...
}
}
-
Route
wp-json/tainacan/v2/filters/(?P<filter_id>[\d]+)
-
Endpoints supported:
-
GET (Fetch a filter)
-
DELETE (Delete or trash a filter)
To delete pass in body of requisition the parameter is_permanently as true. To only trash pass false.
-
PATCH or PUT (Update a filter)
Example of JSON passed in body for updating a filter:
-
-
{
"name": "string",
...
}
-
Route
wp-json/tainacan/v2/filters
-
Endpoints supported:
- GET (Fetch all filters)
-
Terms
-
Route
wp-json/tainacan/v2/taxonomy/(?P<taxonomy_id>[\d]+)/terms
-
Endpoints supported:
-
GET (Fetch all tems of a taxonomy)
-
POST (Create a term in a taxonomy)
Example of JSON passed in body for creating a term:
-
-
{
"name": "string",
"user": "int",
...
}
-
Route
wp-json/tainacan/v2/taxonomy/(?P<taxonomy_id>[\d]+)/terms/(?P<term_id>[\d]+)
-
Endpoints supported:
-
GET (Fecth a term of a taxonomy)
-
DELETE (Delete a term of a taxonoy)
-
PATCH or PUT (Update a term in a taxonomy)
Example of JSON passed in body for updating a term:
-
-
{
"name": "string",
...
}
Logs
-
Route
wp-json/tainacan/v2/logs
-
Endpoints supported:
- GET (Get all logs)
-
-
Route
wp-json/tainacan/v2/logs/(?P<log_id>[\d]+)
-
Enpoints supported:
- GET (Get a log)
-
Others
To Create, Read, Update or Delete Media or Users you can use the default routes of Wordpress.
See about Media in Media | REST API Handbook;
See about Users in Users | REST API Handbook.