Consuming JSON with encoded url - json

I am trying to get response from Java system which will send response in the JSON data format.
For request , the HTTP Method is POST ,
Content Type is application/x-www-form-urlencoded and
Input params is
credentials=user10,TCS&password=TCS&action=getUserItem
s&domainName=user10&departmentId=
The url to connect the system is http://www.trex:5500/TCS/IntServelt
To connect the JAVA Restful services , below are my queries:
Should I form the url as
http://www.trex:5500/TCS/IntServelt&credentials=user10,TCS&password=TCS&action=getUserItems&domainName=user10&departmentId=
I have just copy pasted the Input parameter in the provided url ?
Does the sequence of the parameter matters? Is there any format for that?
Please share inputs.
Regards

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?

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

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.

Pentaho HTTP Post multipart/form-data

I am trying to use HTTP Post to post the data by passing following Header and Body part,
Body:
One image URL having file path. Type as 'File'
Metadata in JSON format. Type as 'Text'
Headers:
Content-type = multipart/form-data
Authorization = Bearer 5412
Here is the screenshot of complete request,
This is how I have setup the HTTP Post task in Pentaho,
I found related post here using REST Client but this also didn't help: Pentaho HTTP Post using JSON
Really appreciate your help.
I think the problem is that "Post a file" doesn't mean include a file in the request, but rather to get the entire request from that file.
I don't know the specifics of how the data should look in the Post request, but the rough approach should be:
Pass the filename field to a Calculator step with the operation "Load file content to binary" to get a binary type field (ex: myimage)
Base64 (or other) encode the data with a Javascript step like this:
var encString = new Packages.java.lang.String( Packages.org.apache.commons.codec.binary.Base64.encodeBase64( myimage ) );
Wrap it in some content-type string indicating the encoding
Include the field in your request.
There is a patch on https://jira.pentaho.com/browse/PDI-14743 to enable proper binary transfer instead of String when using Rest Client.

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.

Raw Json data in request in liferay web service

I am using liferay 6.2 & i have invoked few web services.The thing is that when passing parameters as form data it works fine, get the json response, but the issue is when pass parameters as raw data json form it gives error "message": "No JSON web service action associated with path /login/user-login and method POST for //xxx-portlet"
This means it doesn't work with Content-Type: application/json. I was trying these things through postman the tool in chrome.I want the my json web service should accept the json raw data in request.