Skip to content

Clear relationship by sending null data with PUT doesn't work #656

@Zooip

Description

@Zooip

In JSON-API specs, it is written that the following request must clear my relationship

PATCH /articles/1/relationships/author HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": null
}

When I try, i get a 500 error :

"exception": "undefined method `[]' for nil:NilClass",
"backtrace": [
          "**/jsonapi-resources-0.7.0/lib/jsonapi/request.rb:589:in `parse_update_relationship_operation'",
          ....
  ]

On the other way, when I send an update request with a non-existing id, server responds with 204 No Content and the relationship is set to nil. I would have expected a 422 error but the JSON-API doesn't specifies anything on this.

Did I get something wrong ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions