Which REST verb should I use to compute my request? POST
or PUT
.
For example:
Request:
{
start:[
"1",
"2"
],
end: [
"2",
"3"
]
}
Response:
{
new:[
"3"
],
stayed: [
"2"
],
gone: [
"1"
]
}
Which REST verb should I use to compute my request? POST
or PUT
.
For example:
Request:
{
start:[
"1",
"2"
],
end: [
"2",
"3"
]
}
Response:
{
new:[
"3"
],
stayed: [
"2"
],
gone: [
"1"
]
}
Since your request is nullipotent, you should use GET
. You can send the data as a JSON query parameter.
Here is a helpful Q&A about how to do generate a URL containing a query parameter.
Please provide more info about what you're doing/intending to do to help us out. That being said, when using REST calls, GET, PUT, POST, and DELETE perform the basic CRUD operations. GET returns a value, PUT updates an existing value, POST creates a new value, and DELETE deletes a value. This applies to any format (XML, JSON, etc). For adding new values to a server, use POST if the value doesn't already exist on the server and PUT if it does but you want to update its value(s). I hope this helps. If you need more help, please provide more background info on what you're trying to do.