0

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?

asked Apr 30, 2017 at 12:06

1 Answer 1

3

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.

answered Apr 30, 2017 at 12:11
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.