CakeDC / cakephp-api

API Plugin for CakePHP
Other
61 stars 33 forks source link

JSONApi output format #12

Closed mtancoigne closed 7 years ago

mtancoigne commented 7 years ago

This question is like #11 but for JSONApi formatting:

{
  "data": {
    "id": "1", // Item id
    "type": "authors", // Model name
    "attributes": { // Other attributes
      "name": "J. R. R. Tolkien",
      "date_of_birth": "1892-01-03",
      "date_of_death": "1973-09-02",
      "created_at": "2016-12-31 03:52:33",
      "updated_at": "2016-12-31 03:52:33"
    },
    "relationships": { // Interesting section
      "books": {
        "links": {
          "self": "/v1/authors/1/relationships/books",
          "related": "/v1/authors/1/books"
        }
      },
      "photos": {
        "links": {
          "self": "/v1/authors/1/relationships/photos",
          "related": "/v1/authors/1/photos"
        }
      }
    },
    "links": { // Links
      "self": "/v1/authors/1"
    }
  }
}

As this format seems much more complex to reproduce, the documentation should really state what does what in the plugin, and how we can extend it. I'd be happy to help in any way, but I first need to understand how the plugin can be extended.

skie commented 7 years ago

This question still actual?

mtancoigne commented 7 years ago

@skie I haven't tested CakePHP-api in a while, so I don't know...