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.
Related
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
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.
I debugged some of Facebook's internal endpoints and I found a wired response payload.It contains a for loop and JSON blob, why and what could you do with this loop?
Endpoint:
https://www.facebook.com/ajax/bootloader-endpoint/?modules=PagesCometHeaderActionsMenuWrapper.react&__user=100015575597279&__a=1&__dyn=7AzHK4HwBgC265Q2m3m8GEnxenFw9uu2i5U4e2O14xtoK3q322aewXwnEboG4E6icwJwpUe8hw8u1_w5nCxS320LE36xOfwwwto88hwKx-8wgolzUOm0Z84a3aUS2G2CaCzU7W8wnolwBgK7qwpE31wLxG4UaoC9xy48aU8od8-Uqxy1qxi4UaEW1-xS6FobrwKxm5oe8aU&__csr=i-ABExfiGWDGZmGJ5ybF2krpA9OeahlWQhhebaFUwFqZ34Xy9nNydnV11KyVaiE8CBx7b5PPi4nqiu-QFBbmjO5BllBeLIgWDiGyGWx2-ZrG8VF39KuG8jyLb8hqyuHo-nluKAuG-iiboGuad_BAmiOCoB5ja4ohyHF3SEqzoRqHBxm8wNCxqagF3Q2KPVpcGWB8Qcc8Fabj9O3R8Z2ol1jBh5XBxhy8hhGh9A9gl8i4W8FGvzUybyXgnoBaEJyJUqz6VWHYyjC8qidAAQozTF27KjCxCb89aFEw89rJeFQEvG46kx8hpEz9HgEEACA9xumgN8C9l4xfxG48jx6q4XwOwXp8lCyUcoAwlo6S585O5F42e-ESuh28eovy826zU1io17ywA40lXDwNwgbhF8a1GAyp8R90Vwlokwj86a5UO1nymUd81Zo6y0aFw9hwAwiUkFotO3o2iZw0zNg0BJDxS05M8&__req=4b&__beoa=1&__pc=EXP2%3Acomet_pkg&dpr=1&__ccg=EXCELLENT&__rev=1002161314&__s=1230in%3Abrvifg%3Amzu1bs&__hsi=6830485538918903931-0&__comet_req=1&fb_dtsg_ag=AQwgOCcgcTnzy1lHrbQZrrvOi7cJxlEv9ZUjz_UIpjST3Q%3AAQzhkyxOruEzbCZ3LoN8vL-SCR6BlPZlbK4ENaGWHzZyhw&jazoest=28405&__spin_r=1002161314&__spin_b=trunk&__spin_t=1590346344
Example json:
for (;;);{"bootloadable":{"BanzaiODS":{"r":["csr:_4b_2"],"rds":{"m":["BanzaiODS","BanzaiScuba"]}},"FbtLogging":{"r":["csr:_4b_3"]},"Banzai":{"r":["csr:_4b_4"],"rds":{"m":["BanzaiODS","BanzaiScuba"]}},"BanzaiScuba":{"r":["csr:_4b_5"],"rds":{"m":["BanzaiODS","BanzaiScuba"]}...
It's a protection againt JSON hijacking. The goal is to invalidate JSON data in order to prevent these kind of attacks.
You can find more information on JSON hijacking in the following links :
a presentation of JSON hijacking : https://dev.to/antogarand/why-facebooks-api-starts-with-a-for-loop-1eob
Is facebook suddenly safe against JSON hijacking?
Is JSON Hijacking still an issue in modern browsers?
I am trying to make an API call to Microsoft's form recognizer to analyze a form against a custom model and I can't figure out how to do it.
Here is the documentation on the API
https://westus2.dev.cognitive.microsoft.com/docs/services/form-recognizer-api/operations/AnalyzeWithCustomModel
The request body is blank and I don't really know how that ought to be formatted in order to be sent off.
If you look at the POST Train model method, I was able to use that request body to send make that api call work. This indicates that the problem is me and not the API.
I have successfully done this with curl through command line...
curl -X POST "https://formrecognizerbp.cognitiveservices.azure.com/formrecognizer/v1.0-preview/custom/models/[MODEL ID]/analyze" -H "Content-Type: multipart/form-data" -F "form=#\"C:\Temp\Capture1.jpg\";type=image/jpeg" -H "Ocp-Apim-Subscription-Key: [SUBSCRIPTION ID]"
I don't really know/can't figure out how to convert that into a request body similar in format to what the POST Train Model method has.
I keep getting this error because I don't know how to format the request properly.
Internal : Unexpected error Error during Web API HTTP Request
HTTP Status Code: 400
HTTP Response Content: {"value":{"error":{"code":"BadRequest","message":"Could not process incoming request: 'Missing content-type boundary.'. Please ensure that it is well-formed."}},"formatters":[],"contentTypes":[],"statusCode":400}
So I guess formatters and contentTypes are the missing pieces but would that just be the file path and the image/jpeg parts of the curl ?
The /trainCustomModel API expects the data to be present on the Azure Blob storage. The request body to this request needs to contain a valid SAS URL to the training data. Once you successfully create a custom trained model ID, you could use that to analyze the forms. The /AnalyzeWithCustomModel API expects the data to be on your local file storage. Please ensure that you have the replaced the ModelId, API Subscription Key (Note this is not the same as subscription ID) and the local path to the image correctly.
The issue was that I did not realize that the curl script was overwritting the multipart/form-data Content-Type with image/jpeg and when I was trying to build out this call differently I was forcing a multipart/form-data Content-Type on what was a jpeg.
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.