Text contents
Summary of text contents endpoints
- GET /admin/api/texts - list all available text contents for the current site.
- GET /admin/api/texts/1 - get data for a single text content.
- PUT /admin/api/texts/1 - update attributes of a text content.
List all available text contents for the current site
GET /admin/api/texts
Example response:
Status: 200 OK
[
{
"id": 1,
"created_at": "2014-01-14T09:25:22.000Z",
"updated_at": "2014-01-14T09:26:17.000Z",
"url": "http://helloworld.voog.co/admin/api/texts/1",
"content": {
"id": 1,
"name": "body",
"created_at": "2014-01-14T09:25:22.000Z",
"updated_at": "2014-01-14T09:25:22.000Z",
"position": 1,
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/1"
},
"parent": {
"id": 1,
"title": "Home page",
"created_at": "2014-01-14T09:22:49.000Z",
"updated_at": "2014-01-14T09:22:54.000Z",
"type": "page",
"url": "http://helloworld.voog.co/admin/api/pages/1"
}
}, {
"id": 2,
"created_at": "2014-01-14T11:43:42.000Z",
"updated_at": "2014-01-14T11:44:07.000Z",
"url": "http://helloworld.voog.co/admin/api/texts/2",
"content": {
"id": 2,
"name": "body",
"created_at": "2014-01-14T11:43:42.000Z",
"updated_at": "2014-01-14T11:43:42.000Z",
"position": 2,
"url": "http://helloworld.voog.co/admin/api/pages/3/contents/2"
},
"parent": {
"id": 3,
"title": "Contact",
"created_at": "2014-01-14T11:43:37.000Z",
"updated_at": "2014-01-14T11:43:37.000Z",
"type": "page",
"url": "http://helloworld.voog.co/admin/api/pages/3"
}
}
]
Parameters
per_page- elements per response (default:50; maximum:250).page- requested page (default:1).parent_idandparent_type- parent id and type. Returns text contents for parent. If present then both parameters are required. Allowed values forparent_typeare:page- parent is page.languageparent is language.article- parent is article.
Filter attributes
Read more about filters.
- Object
textattributes:id,body,created_at,updated_at. - Object
contentattributes:id,parent_id,language_id,content_id,content_type,page_id,page_type,name,position,created_at,updated_at.
Get data for a single text content
GET /admin/api/texts/1
Example request:
GET http://helloworld.voog.co/admin/api/texts/2
Example response:
Status: 200 OK
{
"id": 2,
"created_at": "2014-01-14T10:22:04.000Z",
"updated_at": "2014-01-14T10:22:04.000Z",
"url": "http://helloworld.voog.co/admin/api/texts/2",
"content": {
"id": 3,
"name": "body",
"position": 1,
"created_at": "2014-01-14T10:22:04.000Z",
"updated_at": "2014-01-14T10:22:04.000Z",
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/3"
},
"parent": {
"id": 1,
"title": "Home page",
"type": "page",
"created_at": "2014-01-13T09:19:04.000Z",
"updated_at": "2014-01-13T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/pages/1"
},
"body": "<h3>A better way to create a website</h3>"
}
Update attributes of a text content
PUT /admin/api/texts/1
Example request:
PUT http://helloworld.voog.co/admin/api/texts/2
Example data:
{
"body": "<h3>This is my first title</h3>",
}
Example response:
Status: 200 OK
{
"id": 2,
"created_at": "2014-01-14T10:22:04.000Z",
"updated_at": "2014-01-14T10:44:04.000Z",
"url": "http://helloworld.voog.co/admin/api/texts/2",
"content": {
"id": 3,
"name": "body",
"position": 1,
"created_at": "2014-01-14T10:22:04.000Z",
"updated_at": "2014-01-14T10:22:04.000Z",
"url": "http://helloworld.voog.co/admin/api/pages/1/contents/3"
},
"parent": {
"id": 1,
"title": "Home page",
"type": "page",
"created_at": "2014-01-13T09:19:04.000Z",
"updated_at": "2014-01-13T09:19:04.000Z",
"url": "http://helloworld.voog.co/admin/api/pages/1"
},
"body": "<h3>This is my first title</h3>"
}
Parameters
Required parameters:
body- new content for the object.