Suppose I have deployed this function to the cloud:
AddTwo[n1_, n2_] := n1 + n2;
I know how to invoke the API using an HTTP GET: http:///AddTwo?n1=2&n2=2. What Content-Type and request body do I need to send in an HTTP POST in order for the API to be invoked correctly? I cannot find any examples of this in the documentation, and I have not been able to use the Instant API “Test” function successfully with the HTTP POST radio button enabled.
Unfortunately, the API “Test” for POST is broken (and has never worked correctly). The good news is that it’s not hard to do with Wolfram Language.
The Content-Type can be text/plain, since I’m assuming that you want to add numbers. It can be set to anything that Interpeter can handle (e.g., for images, image/jpeg).
Using URLFetch, we can specify the method as POST. The full call looks like this: