Skip to content

Instantly share code, notes, and snippets.

@warpech
Last active December 21, 2015 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warpech/6279679 to your computer and use it in GitHub Desktop.
Save warpech/6279679 to your computer and use it in GitHub Desktop.
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
Copy link
Author

warpech 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