i-e-b / Huygens

Cut down Cassini server for internally hosting IIS sites
Other
3 stars 1 forks source link

POST data #4

Closed Pavel-Teplitsky closed 5 years ago

Pavel-Teplitsky commented 5 years ago

Hi, Could you please show an example for how to make a POST API call with post data, for exmple to call such action http://prntscr.com/lvw58d

Thank you

i-e-b commented 5 years ago

SerialisableRequest has a Content field for the message body, and a Method field for the HTTP verb. Setting Method = "POST" will make the request into a Post call. The Content data is up to you -- Huygens doesn't have any knowledge of the run-time you are using, so you will have to do any encoding yourself. An example if you are using Newtonsoft JSON.Net would be something like Content = Encoding.UTF8.GetBytes(JsonConverter.SerializeObject(MyObject)).