need two services related to the object "item".

  1. To get the details of the item. Though it is a method to get data, I will be using POST since my pathParam/MatrixParam list is too long(Say, purchaserIds provided in the matrixParam is used to fetch the items they have bought). To avoid "URI too long" exception, I made it POST.

  2. To save the item with some details. This will also be a POST method since it is saving/updating.

Now, both services will have the same url http://...../item and both will have httpMethod as POST.

How can we differentiate these 2 services by the URL? Is it right to make it "http://.../item/save" and ".../item/get"?

2

There are 2 best solutions below

1
On

If your URLs would end up too long, it sounds like your URL design is wrong - GET against http://.../items/1/purchasers/ would (for example) be a decent URL to return all the people who have bought item 1, then to update item 1, you would PUT to http://.../items/1/ and to create an item you would POST to http://.../items/

The URL scheme you decide does not sound RESTful, as you're using it to describe actions rather than resources - the URL should identify the resource you are accessing rather than what to do to it.

1
On

To get the details of item you will need to use GET method with item id as path parameter.

http://....../itemid

using POST for GET will defeat the purpose and entire design of the api will be disturbed.