Web Services : Learning POST by Example. Invoking Cognitive Service APIs by Microsoft.

i was recently working with some Computer Vision APIs from Microsofts Project Oxford. I was especially interested in the vision apis

https://www.projectoxford.ai/demo/vision#Analysis

As i write this post on Web Services POST .. pun unintended – the interesting thing I noticed working with this vision stuff is how simple they have made the whole process of invoking their web service via POST messages.

Requests:

  1. Request URL
  2. Request Parameters
  3. Request Headers
  4. Request Body

Response:

  1. Response 200
  2. Response 400
  3. Response 415
  4. Response 500.

These folks have even provided code samples in several languages :

  1. Curl
  2. C#
  3. Java
  4. JavaScript
  5. ObjC
  6. PHP
  7. Python
  8. Ruby

References:

–> very helpful. check it out

Code

 

 

 

 

 

 

 

Web Services : Understanding C# HttpClient

C# has a HttpClient class, which should be easier to use, support async programming and allow users to set any headers without reverting to some workaround code (cf. WebClient and its underlying classes).

It is necessary to understand this class properly in order to do serious coding for Web Service development.

References:

  1. http://d-fens.ch/2014/04/12/httpclient-and-how-to-use-headers-content-type-and-postasync/
  2. http://stackoverflow.com/questions/10679214/how-do-you-set-the-content-type-header-for-an-httpclient-request
  3. https://msdn.microsoft.com/en-us/library/hh944521(v=vs.118).aspx
  4. https://www.jayway.com/2012/03/13/httpclient-makes-get-and-post-very-simple/