Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It is impossible to create a new resource when providing a client-generated ID #281

Open
unterwegsmitkeks opened this issue Aug 3, 2020 · 3 comments
Labels

Comments

@unterwegsmitkeks
Copy link

  • When I'm POSTing a new instance, the service I'm consuming checks if an ID is provided with the request.
  • If not it will generate an ID. If however I'm providing an ID, the service will use it as long as it is unique.

The request body with an ID should look like this:

{ "data": { "id": "my-own-id", "type": "atype", "attributes": { "foo": "bar" } } }

  • When sending this request through Postman, the result is status 200.
  • However, when using ngx-jsonapi, the service returns status 400.
@kirkasius
Copy link

I have experienced the same issue.

The problem is that ngx-jsonapi is adding the id also to the url if it is present in the data. The url
should be http://SERVER/api/atype instead of http://SERVER/api/atype/my-own-id.

@pablorsk
Copy link
Member

pablorsk commented Aug 4, 2020

The bug is only the URL modification? Or you detect another bug?

@pablorsk pablorsk added the bug label Aug 4, 2020
@unterwegsmitkeks
Copy link
Author

The bug is only the URL modification? Or you detect another bug?

My bad - I had actually detected the URL issue, too, but forgot to mention it in the bug description. It looks like that is the actual bug. Otherwise, the function is behaving as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants