user2011423
user2011423

Reputation: 51

REST API Design with many input parameters including collections

I need to design and implement a REST API where users need to pass many input parameters. Out of those input parameters few are collection of an integer, few of them are date strings etc. After getting all these parameters I need to return unique id in the response. What method type (PUT, POST or GET) I should use in order to implement this API? How can I pass all these parameters to the API? I don't want users to format input parameter list into XML or JSON and post as a request body.

I appreciate if anybody can help on this topic.

Upvotes: 0

Views: 1176

Answers (1)

moonwave99
moonwave99

Reputation: 22820

POST is for creating new resources.

PUT is for updating existing resources. A PUT call should be idempotent, i.e. issuing the same request twice will end in no side effects.

To get an overall clue on how RESTful services work, read this article.

And yes, if you want your users to submit a complex set of parameters JSON/XML is the best way to go of course.

Upvotes: 1

Related Questions