Skip to content

Instantly share code, notes, and snippets.

@warpech warpech/gist:6279679
Last active Dec 21, 2015

Embed
What would you like to do?
Current and expected response
//Request
//http://81.236.246.27:8080/mailboxes/Inbox
//Accept:application/json-patch+json
//Current response
[{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Hi there","Uri":"/mails/123"}},
{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Buy diet pills","Uri":"/mails/124"}},
{"op":"add","path":"/Mails","value":{"From":{"Address":""},"Subject":"Business opportunity","Uri":"/mails/125"}},
{"op":"replace","path":"/Mails/0/Subject","value":"Hi there"},
{"op":"replace","path":"/Mails/0/Uri","value":"/mails/123"},
{"op":"replace","path":"/Mails/1/Subject","value":"Buy diet pills"},
{"op":"replace","path":"/Mails/1/Uri","value":"/mails/124"},
{"op":"replace","path":"/Mails/2/Subject","value":"Business opportunity"},
{"op":"replace","path":"/Mails/2/Uri","value":"/mails/125"}]
//Minimum valid response
[{"op":"add","path":"/Mails/0","value":{"From":{"Address":""},"Subject":"Hi there","Uri":"/mails/123"}},
{"op":"add","path":"/Mails/1","value":{"From":{"Address":""},"Subject":"Buy diet pills","Uri":"/mails/124"}},
{"op":"add","path":"/Mails/2","value":{"From":{"Address":""},"Subject":"Business opportunity","Uri":"/mails/125"}},
{"op":"replace","path":"/Mails/0/Subject","value":"Hi there"},
{"op":"replace","path":"/Mails/0/Uri","value":"/mails/123"},
{"op":"replace","path":"/Mails/1/Subject","value":"Buy diet pills"},
{"op":"replace","path":"/Mails/1/Uri","value":"/mails/124"},
{"op":"replace","path":"/Mails/2/Subject","value":"Business opportunity"},
{"op":"replace","path":"/Mails/2/Uri","value":"/mails/125"}]
//Perfect response
[{"op":"add","path":"/Mails/0","value":{"From":{"Address":""},"Subject":"Hi there","Uri":"/mails/123"}},
{"op":"add","path":"/Mails/1","value":{"From":{"Address":""},"Subject":"Buy diet pills","Uri":"/mails/124"}},
{"op":"add","path":"/Mails/2","value":{"From":{"Address":""},"Subject":"Business opportunity","Uri":"/mails/125"}}]
@warpech

This comment has been minimized.

Copy link
Owner Author

commented Aug 20, 2013

The difference is in "op": "add"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.