My Rest API returns a tree structure like this:
[
{
"name":"test old",
"id": 1,
"type":"a-object",
"spend":13,
"status": "active",
"children":[
{
"name":"test women old",
"id": 2,
"type":"b-object",
"spend":13,
"status": "active",
"children":[..]
}
]
}
]
I would like to tell the user for each node which fields could be updated for example, for the first a-object test old he can only set the status, while for b-object he can set the status, name and spend.
What is the REST API way to do it?
I tried to look for an example for a API that does such a thing and didn't find - do you know of one that does it?
1 Answer 1
To comply with rest you need to manipulate (get,put...) whole resources. Make each modifyable field within your main resource a sub resource... then use hateoas to notify users of the operations that can be performed on each sub resource.
Explore related questions
See similar questions with these tags.