0

The scenario:

The consumer provides a large XML input as a request. I will have to parse the XML and get the results from the Database and provide the XML result as a Response.

Example Input:

<XML>
  <PARTS>
    <PART>123123123</PART>
    <PART>123123123</PART>
    <PART>4535345</PART>
  </PARTS>
</XML>

Actual input is big. Say for 10,000 parts.

Output I will have to provide the part description, unit of measurement, etc etc by parsing the xml input, find the details from the database and respond back with XML or JSON.

How can I design REST based WEB API in .NET? What is the best approach?

Kara
  • 5,650
  • 15
  • 48
  • 55
Suresh Kannan
  • 65
  • 3
  • 8
  • Here is a very good resource for learning more about REST API design: http://codeplanet.io/principles-good-restful-api-design/ – IvanJ Mar 31 '15 at 15:07
  • Thanks for the link. Basically i need to design a Post method to receive the input and respond back with output. In REST Architecture, post method is for the creating a new resource. Here is i am bit confused. – Suresh Kannan Mar 31 '15 at 15:09
  • You can use GET method. With GET method you can send parameters too. – IvanJ Mar 31 '15 at 15:10
  • Can i send a large input using Get method? In my case the request XML is going to be more than 2 MB. – Suresh Kannan Mar 31 '15 at 15:13
  • Hmmm, not sure in that case. – IvanJ Mar 31 '15 at 15:15
  • You can send a GET body with the request, but the semantics is not standardized, so someone in the middle might break it. Do it if you know what you're doing. – Pedro Werneck Mar 31 '15 at 15:24
  • Thanks Pedro. I don't know if this is the right way to it? I am thinking if i have choosen the WEB Api wrongly?! – Suresh Kannan Mar 31 '15 at 15:43
  • I think these 2 questions might help you find an answer http://stackoverflow.com/questions/978061/http-get-with-request-body and http://stackoverflow.com/questions/3468177/restful-way-to-send-commands – redben Jul 30 '15 at 16:58

0 Answers0