{
"_links": {
"self": { "href": "/session/1" }
}
"session_id": 1,
"title": "Apigility: Agile APIs",
"_embedded": {
"speaker": {
"_links": { "self": { "href": "/speaker/1" } }
"speaker_id": 1,
"name": "Matthew Weier O'Phinney"
}
}
}
{
"type": "/api/problems/forbidden",
"title": "Forbidden",
"detail": "Your API key is missing or invalid.",
"status": 403,
"authenticationUrl": "/api/oauth"
}
POST /session HTTP/1.1
Content-Type: application/xml
Foo
405 Method Not Allowed
Allow: GET
OPTIONS /session HTTP/1.1
Content-Type: application/xml
200 OK
Allow: GET
GET /session HTTP/1.1
Accept: application/xml
406 Not acceptable
Content-Type: application/problem+json
{
"type": "/api/problems/content",
"title": "Not acceptable",
"detail": "This API can deliver application/vnd.zend-con.v1+json, application/hal+json, or application/json only.",
"status": 406
}
POST /session HTTP/1.1
Content-Type: application/xml
1
415 Unsupported Media Type
Content-Type: application/problem+json
{
"type": "/api/problems/content",
"title": "Unsupported Media Type",
"detail": "This API can accept application/vnd.zend-con.v1+json, application/hal+json, or application/json only.",
"status": 415
}
PATCH /session/1 HTTP/1.1
Content-Type: application/json
{ "title": {"foo":"bar"} }
422 Unprocessable Entity
Content-Type: application/problem+json
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Unprocessable Entity",
"detail": "Failed validation",
"status": 422,
"validation_messages": {
"title": "Invalid title; must be a non-empty string"
}
}
GET /session/1 HTTP/1.1
Authorization: Basic foobar
Accept: application/json
401 Unauthorized
Content-Type: application/problem+json
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Unauthorized",
"detail": "Unauthorized",
"status": 401
}
GET /session/1 HTTP/1.1
Accept: application/json
403 Forbidden
Content-Type: application/problem+json
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Forbidden",
"detail": "Forbidden",
"status": 403
}
/v1/session
,
/v2/session
Accept: application/vnd.status.v2+json
Zend\Paginator\Paginator
.
{
_links: {
self: { href: "/api/session?page=3" },
first: { href: "/api/session" },
last: { href: "/api/session?page=14" },
prev: { href: "/api/session?page=2" },
next: { href: "/api/session?page=4" }
}
}
Write your own code, however you want …
… but ZF2 is under the hood.