Sim808 + Arduino UNO: Get Json Object Response from Web Server - html

How to read JSON object response from the server?
These are the commands I use:
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","internet"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPSSL=1
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","https://www.mywebsite.com/getTime?token=jsdaljdaskl"
AT+HTTPPARA="REDIR",1
AT+HTTPACTION=0
The returning request should be Json object, but the Sim808 read it as html response which gives error 606.

Need to define HTTP parameter content as JSON format using the following command
AT+HTTPPARA="CONTENT","application/json"
Found this document useful HTTP Client using SIM900.

Related

How to enforce "accept" OR " format" parameters in HTTP URL to enforce XML response from server than a JSON

I am always getting JSON response for my HTTP request to access one ORDS-Oracle Rest Data Services API:
http://localhost:8080/ords/hr/employees/
However my requirement is to get XML response. I tried to choose XML from drop down list available at POSTMAN, however content is not changing to XML.
I need a way to specify parameter as part of HTTP URL so that response is XML than JSON and I tried to change URL like below:
Way1:
http://localhost:8080/ords/hr/employees?format=xml
Way2:
http://abcdef.us.oracle.com:8001/claims-ws/api/generic/lineofbusinesses/421?Content-Type:application/xml
Way3:
http://abcdfef.us.oracle.com:8001/claims-ws/api/generic/lineofbusinesses/421?Accept:application/xml
Way4:
http://abcdef.us.oracle.com:8001/claims-ws/api/generic/lineofbusinesses/421?Accept=application/xml
However nothing is working and response is always JSON.
Any suggestion?

Sending JSON response via GenericJsonWebHookReceiver MVC ASP.NET

I need to send the JSON response from GenericJsonWebHookReceiver provided by Nuget package in ASP.NET.
I am trying to send the JSON value in the return call like this - "return Task.FromResult(sampleJson);"  , where sampleJson is a valid JSON in string format.
But while testing, I am still getting empty response.
How can we send the JSON response with GenericJsonWebHookReceiver? Also how to set the proper header type in the response to define it as JSON type response?
Thanks,
/vikas

How to read body of HttpRequest POSTed to a REST web service - IBM Integration Bus

I am exposing a Rest based POST API and have to read few parameters in the body along with header. I am able to fetch the query string (header) parameters using HTTP Input node query string parser. As i have configured Input parser to JSON, it can not parse the incoming message and gives a runtime exception :
JSON parsing errors have occurred
Content-Type is set to :
application/x-www-form-urlencoded
I am very newbie with Rest/ JSON services on IIB. Help would be greatly appreciated.

Conversion of json object to object in jmeter

I have a POST API consuming JSON Object. I need to pass the JSON as body data to the API. The conversion of JSON Object to the intended class object is failing. Do we have to specify any other parameters?
You have to specify Content-Type header to application/json using HTTP Header Manager (add it as a child to the HTTP sampler of POST request), so that JMeter sends the POST request telling the server that the body contains JSON using the header.

How does server handle JSON in the body of a POST

I am using jQuery to post JSON data to a tomcat server and the server is handling the JSON array data perfectly! It is as though I passed key=value request parameters along with the URL.
So why am I posting this? I would like to know how the server treats JSON in the body of a request and how the data ends up being interpreted as request parameters. I have Googled my a** off and all I find is how the server sends JSON back to the client.
$.ajax() converts JSON data into key-value pairs (querystring style) by default. You need to set { processData : false } in the AJAX request to keep it as raw JSON.