AWS Api Gateway - get spaces in the JSON\ body - json

I sent with postman some JSON body to AWS API Gateway.
for EX: {"test":"test"}
I'm hashing this body (hmac-sha1).
my problem is when I'm hashing the JSON, i don't use spaces between the ":" in the JSON.
when API gateway get the body JSON is adding spaces in the JSON between the ":".
to avoid future problems i want to handle the body as is, without manipulate it.
i try use with and without template integration at the API gateway,
with $input.json('$') & $input.body.
empty integration & etc..
the question, how i get the body as is he sent from the client?
thanks.

Related

How to send a GET request with JSON body in JMeter?

I am facing some issues as JMeter doesn't take the JSON body passed as a parameter. I tried through postman and it was working fine but for Jmeter it is not working
I am expecting a response from get request with JSON body in Jmeter
We're not telepathic enough in order to suggest you how you can fix your "some issues" without knowing the details of the "issues"
JMeter can send the GET request with the JSON (or any other) body
If the request works in Postman and doesn't in JMeter most probably you're not sending the same requests, the most common mistake is that people forget to add a HTTP Header Manager configured to send correct Content-Type header.
Just use a 3rd-party sniffer tool to intercept requests originating from JMeter or Postman, identify the difference(s) and amend your JMeter configuration so the requests would be exactly the same. Alternatively just record the request from Postman using JMeter's HTTP(S) Test Script Recorder

Azure Key Vault API Not accepting raw JSON body params

I have to use raw json in my post query to Azure Key Vault. Which I've done like so:
{ "grant_type":"client_credentials" }
I get a 400 error complaining that the body does not have 'grant_type'
How can I get Azure Key Vault API to accept the raw json body?
The headers are in the attached image
headers
body in Postman:
body
using urlencoded in raw-JSON body
The endpoint is: https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token which returns a temporary access token.
Microsoft has confirmed with me that this endpoint cannot accept raw-JSON so I'll have to find some other way for my implementation.
Your post data needs to be URLEncoded. This can be done in Postman using a pre-request script. You can read the full walk-through on Jon Gallant's blog here: Azure REST APIs with Postman or watch the video here: https://learn.microsoft.com/en-us/rest/api/azure/
This endpoint cannot read raw JSON.
The only solution is to modify the request body to use urlencoded format.
In Postman this can be done by changing the content type to: application/x-www-form-urlencoded
and the body to Raw with the content inside the body as &{key}={value} for every key, value that the endpoint requires.
Without access to the API sending the request I'm unfortunately unable to solve this issue since I'm forced to use JSON objects as the request body.

How to consume REST Endpoint with wso2 api manager?

I can consume SOAP APIs in my company with wso2 api manager. However when I want to consume REST endpoints I am unable to do so. I keep getting no response.
My endpoints are like such:
GET: http://{server}:{port}/api/broker/{brokerId}
POST: http://{server}:{port}/api/addresscleanse with json payload.
I am not seeing any configuration for the backend point where we can specify that the backend service is expecting json payload or queryparameter. I tried to scan the tutorial section and did not find any thing similar to my need.
Any help would be appreciated.
You can define your resources like below. To specify the message body type of the POST request, you can send Content-Type header.

Google OAuth - Incorrect JSON while Validating Access Token

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.

Sending comma seperated string in json request to rest client web service

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?