Using file as payload in Advanced REST Client - json

I'm trying to work with the Advanced REST Client of Google.
I installed the extension, and I can work with it.
Now I wanted to use a JSON-file as input for my payload.
The JSON-file looks as follows :
{"UserName":"", "UserPassword":"","SetDebug":true}
The Content-Type is set to application/json.
But when I try to send the request I get the following error:
{
"Message": "The request entity's media type 'multipart/form-data' is not supported for this resource."
}
What am I doing wrong? Can anyone help me?

The ARC seems to override your Content-Type selection sometimes, changing it to multipart-form-data. If you select Files for the body and pick a file, it shows a message saying:
The Content-Type header will finally be changed to "multipart/form-data" during the request.
When you submit the request, it does exactly that: changes the Content-Type header. You can confirm this by looking in the Request Headers part of the output display.
I don't know if there's any way to stop it doing this :(-

Related

how to send a Request's parameter using HTTP tool in Logic app

I'm trying to send a request using HTTP tool as you can see
but i get this error:
{
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: -e540--94fd-\r\nCorrelation ID: -0b33--8557-\r\nTimestamp: 2022-08-18 11:25:43Z",
"error_codes": [
900144
],
although i can achieve this using Postman but i don't know if i'm using it the right way.
and because it's in x-www-form-urlencoded format i can't just paste it in Body, i guess it has to be in Json format to be used in Body.
how can should use this values in HTTP tool of Logic App?
i found the answer here. you just need to add in the header section:
Content-Type: application/x-www-form-urlencoded
and in the body your x-www-form-urlencoded foramated string.

Callout failed for invocable action in flow

I am trying to send an API request to the external service using flow in salesforce but when I debug my flow it returns the below error
Error Occurred: Callout failed for invocable action testing3.post-vacancy-id. Expected declared response media type application/json, but got application/problem+json; charset=utf-8 for operation post-vacancy-id and service testing3
I have not specified the content-type in the header (cause I don't know how to define that in the header in flow) but I found that it will take the default content-type as application/JSON and also I have checked the body of the API request it is work fine when sending it from the postman.
I have searched regarding this but didn't find anything on the web, any help will be appreciated here.
thanks!!

Post request and get response robotframework

I need to send POST request and get json from it.
Create Http Context emopstest.pdc.org http
Set Request Header Content-Type application/x-www-form-urlencoded
Set Request Header Authorization Basic bG9naW46cGFzcw==
${dict}= Create Dictionary app_ids=18 where=ROWNUM<=2000
${value}= Stringify Json ${dict}
Set Request Body ${value}
HttpLibrary.HTTP.POST /auth_srv/services/auth/1/json/get_hazards
Show Response Body In Browser
Response Status Code Should Equal 200
${result_text}= Get Response Body
${result_json}= Parse Json ${result_text}
But this code returns to me 404...
What is wrong?
The 404 means that the server couldn't find the resource you requested. Usually that means the URL was wrong. Depending on how the server is configured, it could also mean that your authorization is wrong (ie: some applications will give a 404 in the case of bad authentication, so that an attacker isn't given a clue that the credentials are incorrect)
The server logs should have information that will help you track down whether you have an incorrect URL or that the server has a bug.

How to specify mime-type in URL to specify JSON from RESTful web service

Can anyone tell me if it is possible to specify mime-type returned from a RESTful web service through the URL? I am trying to demo a simple service that I created to someone and I am just using a web browser (Chrome) to invoke the service. I am trying things like this:
http://localhost:8088/providers?mimeType={application/json}
http://localhost:8088/providers?mimeType=application/json
http://localhost:8088/providers?mimeType=json
None of these work for me - I just keep getting XML returned no matter what I select.
I found several posts related to this subject, but nothing with an answer about how to do this through a URL (I found some which talked about setting headers, but I am using a browser and don't have the ability to specify headers). I found this post:
REST Content-Type: Should it be based on extension or Accept header?
And that post linked to this: http://www.xml.com/pub/a/2004/08/11/rest.html
On the xml.com site, I found this text:
URI-Specified Representation [PS, AR]
A client can specify the representation using the following query string:
mimeType={mime-type}
A REST server should support this query.
So it seems that what I am trying to do should be possible, but I can't figure out how to make it work. Can anyone help?
Thanks.
To define the headers added to your request, you can use a Chrome extension like Postman.
Then you will be able to specify an Accept header to tell Talend to return json:
Accept: Application/json

Track navigation with jmeter

I try to make a stress test with jmeter: i set up jmeter proxy to record navigation and everythings is ok.
I have some problem with a page wich has a json request called by javascript: using the jmeter proxy this request doesn't works.
With firebug I can see that the response of json request is
{"error":{"msg":"couldn't parse request arguments","code":590}}
It seems that jmeter proxy modify the parameter request.
With this error, I cannot use this page: any suggest?
Thanks
Aldo
JMeter isn't able to execute JavaScript, you'll need to construct the request manually. Perhaps you'll need to get some parameter(s) from page source via Regular Expression Extractor. Once you figure out correct request make sure that you'll add Content-Type header application/json via HTTP Header Manager