Extra attributes sent from client

I have a question about Server-side behavior on extra attributes, or fields in general, in request body resource data.

The case is:
I have a resource that has field A, but client send me resouce object that has field A and field B.

The question:
How should server respond to this? Of cource I can ignore it, and just process fields I know. Or I can send back a response with exception that field was not recognized, or whole resource linkage is wrong, because resource with field A and field B does not exist. Documentation unfortunatelly does not include answer what to do if request contains extra field data.

Thanks for advice

Technically I think the spec says the server should ignore anything it doesn’t understand, but I plan to error in these cases so the client knows it did something wrong that won’t get “saved”.

Documentation says:

Unless otherwise noted, objects defined by this specification MUST NOT contain any additional members. Client and server implementations MUST ignore members not recognized by this specification.

But additional field in attributes is not additional member. The attributes is member, or data. So in this case documentation is not clear. But for implementation purpose is better to aware client that he is doing something wrong. That should ensure consistency.

Agreed. The documentation there is a bit contradictory. On one hand it says it MUST NOT have extra members, but if it does the server MUST ignore them… LOL

So I just throw an error. Let that sink…:sunglasses::microphone:

1 Like