Open
Description
Here is simple example of what I am doing:
APIFunction[
{},
If[HTTPRequestData["Method"] === "GET",
"400 Bad Request",
ExportForm[HTTPRequestData["Body"], "JSON"]
]&
]
I pass the following JSON object to the endpoint:
{
x: 1,
y: 2,
z: 3
}
I have tried using postman, insomnia and fetch function in javascript to send the payload. All of them complain Expression "None" cannot be exported as JSON. Upon closer inspection, I found that HTTPRequestData["Body"] remains None for some reason.
What would be the best way to deal with JSON payloads in POST requests? It may be helpful to know that the above function works fine when deployed in Wolfram Application Server.
Metadata
Metadata
Assignees
Labels
No labels