Calling .Net Web API from cURL

Tronangerve

New Member
I am writing an authentication provider in .Net as a REST service to make it easier to call from PHP and iOS. I've used the MVC Web API libraries and it all works fine, I can call methods from the browser etc.BUT when I try and call my POST method from cURL using curl -d "something=something" hxxp://myendpoint/api the data passed in the message body with -d is not interpreted to match methods in my Web API class and I cannot see how to gain access to this form type fields.I cannot change the curl call because it is coming from a 3rd-party library and seems to be correct but although I understand that Web API by design only matches uri parameters to actions, I don't understand why I can't access the form data from the Request object (or maybe I can?)\[code\][HttpPost] public AccessToken Post() {} // Matches but can't access form data[HttpPost] public AccessToken Post2(string something) {} // Doesn't match, no parameter in curl uri querystring[HttpPost] public AccessToken Post3(ModelWithOnePropertyCalledSomething data) {} //Matches but can't access form data\[/code\]Is this really something that is not possible with the Web API? Do I have to write custom action selector classes?
 
Back
Top