0

In my WebAPI being desinged, I have urls such as

https://<base_url>api/projects/{projectId}/samples/ (POST)

and I need to specify another method with POST and same base URL, that does things similarly to original, but accepts different payload and returns different payload. At the moment I have

https://<base_url>api/projects/{projectId}/samples/savemasscreation 

"modification" but I am not sure it is a good API practice. What would be the best way to design a modifier for method without necessity to change the resource URL? What would be the best practice - use another HTTP verb, add ?optionalparameter to URL, or something else?

3
  • Can you describe the who POST actions in more detail. Are they interacting with the same object in different ways or totally different objects? Commented Apr 24, 2015 at 13:30
  • @SteveFenton more like different objects, but the logical action is the same Commented Apr 24, 2015 at 14:12
  • I would expect the URL to reflect that... i.e. https://<base_url>api/customers/ and https://<base_url>api/orders/ (both being a POST for example). Commented Apr 24, 2015 at 14:49

1 Answer 1

0

If you are using .NET you can specify the route with a [Route()] attribute and those methods must accept different number of parameters in order to work since both are POST. See this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.