I'm building a simple bot that makes an http post call passing in JSON objects. The server responds back with the error - {"detail":"JSON parse error - Expecting value: line 1 column 1 (char 0)"}:
I don't think the server side is the issue; I've tried the request using httpie.
The code in Gupshup
var contextParam = {
"botname": event.botname,
"channel": event.channel,
"sender": event.sender,
"message":event.message
};
var url = "https://abcserver.com/sm/postData";
var param = JSON.stringify(contextParam);
var header = {"Content-Type": "application/json"};
context.simplehttp.makePost(url, param, header)
The corresponding call from httpie
http POST https://abcserver.com/sm/postData botname=MrBot channel=Skype sender=MrSender message=Hi
At the server side:
logger.debug("Request body : " + str(request.body))
puts - "Request body : b'"
in the log file.
PS: I'm using Django, Django Rest Framework