Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

One must set Content-type: application/vnd.api+json to indicate the {json:api} is used.TODO: Add {json:api} example.

Following is a jsonapi response example showing:

  • The data with mandatory type and id
  • The attributes for this particular type.
  • Relationships data for the (plural) locations relationship which contains types and ids only.
  • Links metadata for the self reference for this item (and the enclosed self link for the relationships)
{
    "data": {
        "type": "Widget",
        "id": "91e5e32e-864f-4d1d-813a-bbd5c46b325d",
        "attributes": {
            "name": "can opener",
            "qty": 43
        },
        "relationships": {
            "locations": {
                "data": [
                    {
                        "type": "Location",
                        "id": "1a5a18bf-8afa-410d-83d3-b4c89155b32f"
                    },
                    {
                        "type": "Location",
                        "id": "805044c9-9a6a-454a-962c-a90ec3f94def"
                    }
                ],
                "links": {
                    "self": "http://34.239.103.140:8000/v1/api/widgets/91e5e32e-864f-4d1d-813a-bbd5c46b325d/relationships/locations"
                },
                "meta": {
                    "count": 2
                }
            }
        },
        "links": {
            "self": "http://34.239.103.140:8000/v1/api/widgets/91e5e32e-864f-4d1d-813a-bbd5c46b325d/"
        }
    }
}