title: Content HTTP API
Ponzu provides a read & write HTTP API to access and interact with content on a system. By default, write access (including create, update and delete) and search are disabled. See the section on Ponzu's API Interfaces to learn more about how to enable these endpoints.
GET /api/content?type=<Type>&id=<ID>
{
"data": [
{
"uuid": "024a5797-e064-4ee0-abe3-415cb6d3ed18",
"id": 6,
"slug": "item-id-024a5797-e064-4ee0-abe3-415cb6d3ed18" // customizable
"timestamp": 1493926453826, // milliseconds since Unix epoch
"updated": 1493926453826,
// your content data...,
}
]
}
GET /api/contents?type=<Type>
- optional params:
order
(string: ASC / DESC, default: DESC)count
(int: -1 - N, default: 10, -1 returns all)offset
(int: 0 - N, default: 0)
{
"data": [
{
"uuid": "024a5797-e064-4ee0-abe3-415cb6d3ed18",
"id": 6,
"slug": "item-id-024a5797-e064-4ee0-abe3-415cb6d3ed18", // customizable
"timestamp": 1493926453826, // milliseconds since Unix epoch
"updated": 1493926453826,
// your content data...,
},
{
"uuid": "5a9177c7-634d-4fb1-88a6-ef6c45de797c",
"id": 7,
"slug": "item-id-5a9177c7-634d-4fb1-88a6-ef6c45de797c", // customizable
"timestamp": 1493926453826, // milliseconds since Unix epoch
"updated": 1493926453826,
// your content data...,
},
// more objects...
]
}
GET /api/content?slug=<Slug>
{
"data": [
{
"uuid": "024a5797-e064-4ee0-abe3-415cb6d3ed18",
"id": 6,
"slug": "item-id-024a5797-e064-4ee0-abe3-415cb6d3ed18", // customizable
"timestamp": 1493926453826, // milliseconds since Unix epoch
"updated": 1493926453826,
// your content data...,
}
]
}
POST /api/content/create?type=<Type>
- Type must implement
api.Createable
interface !!! note "Request Data Encoding" Request must bemultipart/form-data
encoded. If not, a400 Bad Request
Response will be returned.
{
"data": [
{
"id": 6, // will be omitted if status is pending
"type": "Review",
"status": "public"
}
]
}
POST /api/content/update?type=<Type>&id=<id>
- Type must implement
api.Updateable
interface !!! note "Request Data Encoding" Request must bemultipart/form-data
encoded. If not, a400 Bad Request
Response will be returned.
{
"data": [
{
"id": 6,
"type": "Review",
"status": "public"
}
]
}
POST /api/content/delete?type=<Type>&id=<id>
- Type must implement
api.Deleteable
interface !!! note "Request Data Encoding" Request must bemultipart/form-data
encoded. If not, a400 Bad Request
Response will be returned.
{
"data": [
{
"id": 6,
"type": "Review",
"status": "deleted"
}
]
}
All API endpoints are CORS-enabled (can be disabled in configuration at run-time) and API requests are recorded by your system to generate graphs of total requests and unique client requests within the Admin dashboard.
The following headers are common across all Ponzu API responses. Some of them can be modified in the system configuration while your system is running.
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Accept, Authorization, Content-Type
Access-Control-Allow-Origin: *
Cache-Control: max-age=2592000, public
Content-Encoding: gzip
Content-Type: application/json
Etag: MTQ5Mzk0NTYzNQ==
Vary: Accept-Encoding
Date: Fri, 05 May 2017 01:15:49 GMT
Content-Length: 199
access-control-allow-headers: Accept, Authorization, Content-Type
access-control-allow-origin: *
cache-control: max-age=2592000, public
content-encoding: gzip
content-length: 199
content-type: application/json
date: Fri, 05 May 2017 01:38:11 GMT
etag: MTQ5Mzk0ODI4MA==
status: 200
vary: Accept-Encoding
Typewriter Generate & sync front-end data structures from Ponzu content types. (Ponzu example)