mercredi 18 juillet 2018

Ember.sj - How to deal with API-Platform - resource link instead of Id in payload

I use Emberjs 3.2 with Api-Platform and I ran into the following problem:

Here is my API payload:

{
      "id": "/api/articles/0d8cb40c-221b-4c54-9e29-43877093b839",
      "type": "Article",
      "attributes": {
        "_id": "0d8cb40c-221b-4c54-9e29-43877093b839",
        "title": "Article",
        "content": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>",
        "dateCreated": "2018-07-17T18:20:29+03:00",
        "dateUpdated": "2018-07-17T18:20:29+03:00"
      },
      "relationships": {
        "author": {
          "data": {
            "type": "User",
            "id": "/api/users/b26e0381-6800-4f47-b269-9a92b27ad331"
          }
        }
      }
    }

As you can see, I got an IRI instead of id in the payload.

I turned on api-platform option: allow_plain_identifiers: true but I still get IRI instead of ID for the related entities.

How can I deal with this using EmberData JSONApi Adapter?

I appreciate any ideas!




Aucun commentaire:

Enregistrer un commentaire