wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
264 stars 109 forks source link

POST one type of resource, receive a different type in response #176

Closed alextov closed 7 years ago

alextov commented 7 years ago

Hello,

Suppose I have the following API. When user logs in, I'm sending a POST /auth/sessions request with the following payload:

{
  "data": {
    "type": "sessions",
    "id": null,
    "attributes": {
      "email": "johndoe@example.com",
      "password": "aardvark"
    }
  }
}

In response, the server sends me a users resource:

{
  "data": {
    "id": "1234",
    "type": "users",
    "attributes": {
      "email": "johndoe@example.com",
      "about": "About Me",
      "profile_image": null
    }
  }
}

I have studied the JSON API specification and couldn't find anything that would suggest that it's prohibited. However, Spine doesn't seem to support such configuration. Am I missing something? I would appreciate any help!

markst commented 7 years ago

@alextov https://github.com/wvteijlingen/Spine/issues/93#issuecomment-242754289

alextov commented 7 years ago

@markst Thanks for the explanation.