I am using restclient or postman for my web service
Here in I have to send request json :
{"wallpost_id":3338,"share_text_msg":"job fair in usa","logged_in_user_id":37,"receiver_id":19,12}
where i want to send comma separated values, but rest client does not
allow me to use the above format
Therefore I am using Postman to solve the purpose and it is
working fine in postman. But my team at android end want to use
it x-www-form-urlencoded tab of postman, but there the problem
arises. Please suggest that how can i send such format in rest
client.
19,12 is not a valid number. If you quote that as a string (e.g. "19,12") does it work?
Related
I am trying to consume a publicly exposed URL and I need to pass auth headers to it. The format of the HTTP header is :
auth:{"Username": "p09jh789-f098-h6fv-b386-008cd88bd4fe","Password": "xxxxxxxx","authKey": "62b6380d-9e06-6age-cf09-134614b77d5e"}
I tried to set auth header for the REST API and I am not able to pass this JSON string since text headers throw up datatype issue. This happens even if I try to escape the JSON string. Please help me with doing it.
Send each value as a different header item. And validate each item in the OnBeforeRequest.
I'm getting an access token from the Android SDK which I'm sending to the server. On the server side, I'm calling the following API to validate my token:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=<token here>
From Google, I'm getting the following response (partial response added):
{\"statusCode\":200,\"body\":\"{n \"issued_to\":
\"407408718192.apps.googleusercontent.com\",n \"audience\":
\"407408718192.apps.googleusercontent.com\",n \"user_id\":
\"110586055381870434283\",n \"scope\":
\"https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/plus.me"}
Unfortunately, this JSON is not parseable because of the backslashes & i'm not able to validate the token identity.
Is this a problem with the Google API or do I need to apply any regex?
Google sends back proper JSON without the slashes, being exactly the part that's inside the "body" element of the output that you paste (well without the slashes).
So your Node.js HTTP client is wrapping it with the HTTP status code element and puts in the slashes as well, so your clients need convert back from that on its own.
I have a question regarding REST Assured. - https://code.google.com/p/rest-assured/wiki/Usage
I understand that I can use REST assured to make HTTP calls(.get .put etc.) and validate the response using when() etc. I would like to validate JSON responses that I have already saved in the database, instead of Calling the web service realtime and validating it's response.
Can I use REST-assured to Load a JSON response as a String and validate it?
Yes you can use Rest Assured's JsonPath project independently of Rest Assured (see getting started page). Once you have it in classpath you can do something like this:
JsonPath jsonPath = new JsonPath(<your json as string>);
String title = jsonPath.getString("x.y.title");
I'm using Cordys BOP and I have a REST web service that returns JSON format. I have a test service that I use, that returns XML and this works fine so I know that my HTTP connector works right. When I try to test my JSON service using the Test Web Service Operation UI, I get an error that says Invalid XML response.
How do I tell Cordys to expect a JSON response instead of an XML?
Is there a way to somehow wrap a JSON in XML through Cordys?
You probably need to change the header:
Content-type: application/json
I'm learning how to use a third party API called Wunderground and I don't know how to request, receive, and use their results which is in a Json format.
If you see their website a developer can sign up for free and receives an API KEY. You can then request weather data in the following URL format.. http://api.wunderground.com/api/KEY/FEATURE/[FEATUREā¦]/[SETTINGā¦]/q/QUERY.FORMAT
So I have tried it in my web browser by typing some parameters and I received a very long Json file with the correct information (I checked). Problem is I don't have the slightest idea of how to create a variable which can make this request, and even if I was able to do that I don't know where should I receive the file and how to get only the results I want (in this case current weather).
You have to use Titanium.Network.HTTPClient to make request.
For code examples related to Json parsing you can use:
Appcelerator: Using JSON to Build a Twitter Client
HTTPClient()