how/where to add token in http get request in Rest Debugger Delphi - rest

web-service has token parameter. In swagger and postman I send get-request properly (status 200). In Poastman creating request is very easy because it has separate pages for parameters and headers.
As for Rest Debugger I couldn't create and sent right get-request( appears error 400).
I tried many ways but without success:
I write token in request parameter section of Rest Debugger as key-value pair like "token"= "abcd12345..."
or
I write base URL and resouce together in URL-field like:
https://testserver.com/currencies?token=abcd12345..... or
I write resource separately in resouce field of Rest Debugger and base -URL in URL-field
but in all cases server returns error 400:
"the token field is required".
screens of swagger, curl, postman and rest debugger.

We suppose that a better solution is to use Postman for this task, if it works as expected and is more user-friendly. But if it’s principal thing – you can do it in Rest Debugger.
Go to the “parameters” tab -> click the “Add” button -> change “Kind” field to “HEADER” -> “Name” field to ‘’token” -> “value” to your token value.
You can see that in Postman you use a header to send token value, but in Rest Debugger simple param – that’s why you get different results.

Try to define it as header.
Use Parameter section and use [HEADER] instead of [GET/POST]

Related

GPT-3 API invalid_request_error: you must provide a model parameter

I'm new to APIs and I'm trying to understand how to get a response from a prompt using OpenAI's GPT-3 API (using api.openai.com/v1/completions). I'm using Postman to do so.
The documentation says that there is only one required parameter, which is the "model." However, I get an error saying that "you must provide a model parameter," even though I already provided it.
What am I doing wrong?
You can get this to work the following way in Postman with the POST setting:
Leave all items in the Params tab empty
In the Authorization tab, paste your OpenAI API token as the Type Bearer Token (as you likely already did)
In the Headers tab, add key "Content-Type" with value "application/json"
In the Body tab, switch to Raw, and add e.g.
{
"model":"text-davinci-002",
"prompt":"Albert Einstein was"
}
Hit Send. You'll get back the completions for your prompt.
Note alternatively, you can add the model into the Post URL, like https://api.openai.com/v1/engines/text-davinci-002/completions
While above works, it might not be using the Postman UI to its full potential -- after all, we're raw-editing JSON instead of utilizing nice key-value input boxes. If you find out how to do the latter, let us know.
What solved it for me was adding the content-type header:
"content-type:application/json"

REST API calls through Pentaho Data Integration (Spoon)

Hello Pentaho Experts,
I am attempting to make a REST API call through REST Client in Pentaho. I have a Api key for authentication. I tried it in Postman, and it works perfectly fine, but Pentaho throws 403 status code. Below is the postman screenshot:
My Pentaho transformation contains two steps. I am passing URL through "Generate Rows" step and then adding Key and Value in the Header:
Generate Rows:
Rest Client (General):
Rest Client (Header):
Any idea what I might be missing here? Expected output is JSON.
I can't speak to the use of passing key/value in Header for authentication, but what has worked for me is to use the Authentication tab to input my credentials or passing an Authentication header with a bearer token.
Authentication Tab:
I use this method to generate and return a bearer token from the API. The token is then used as the authentication method in subsequent steps. The "body" includes the scope (i.e.: "reports:read") and grant type ("client_credentials"). The "header" contains the value "application/x-www-form-urlencoded".
Authentication Header:
Once a token has been returned from the API, this can be provided in an "authorization" header. Prepend "bearer" to the token value and pass this in the header tab.
I would also recommend looking at the Headers being passed in Postman to ensure you are not missing anything else that might be happening in your call.

Swagger Inspector version of C# call failing when using token

I have the following code:
string tokenValue = "221e0a91-6530-4790-a969-d1da75b0afd2";
// Configure httpClient to use the above token.
httpClient.DefaultRequestHeaders.Add("token", tokenValue);
The subsequent calls (HEAD, POST, GET) all work fine.
When I try to do the same thing using Swagger Inspector, it fails. I am able to get a token using Swagger Inspector site, and I place the token into a HEAD call as follows:
But as I said, the call fails, with "Authorization has been denied for this request." message returned as an XML file.
I also tried the two other options available on the same page: Basic Authentication, and OAuth 2.0/JWT, all with HTTPS. They all fail.
How can I go about understanding why it's failing?
Also: Is what I am using above called "Bearer Authentication"?
I have below 2 things to mention from your screenshot:
Response for HEAD method never contains the response body, it always contains the response headers
for more details of HEAD: HEAD Request
But in your case response-body is also present (maybe of CML content type).
You should use OAuth 2.0/JWT option on the same page to pass the token along with your request.
To answer your question related to Bearer Authentication:
No, the one you are trying to use is not at all Bearer Authentication.
In your case, "token" will be considered as Custom/User HTTP Header.

Using postman for Giphy API Get request but comes back with no data

Like the title says, I'm trying to do a GET request to the Search endpoint of Giphy's API, but it comes back with an empty data array. Is there anything I'm doing wrong? I've made sure the API key is correct since it works for the 'trending' and 'random' endpoints.
Postman Request
In your screenshot, it looks like you've entered the api_key and q as Headers.
Instead, you should submit this information as Request Parameters. If you click the Params button, you'll expand a similar looking key-value editor where you can enter the parameters.

Why am I getting request method GET not supported?

I am using PostMan as a REST client to test this API method Cisco ACL Analysis API. specifically POST /acl/trace or getAClTracksStd (first go to Policy Analysis)
Here is my PostMan HTTP test call
Does anyone who is familiar with PostMan understand why I am getting this "Request method 'GET' is not supported" error from the server? I am making a POST HTTP request, not GET.(Selected from Drop down menu) It make more sense for me to get a input invalid parameter error or something.
Just to show that the endpoint url works, heres a HTTP test request that works
(same link, host->host API -> GET /host/{startIndex}/{recordsToReturn}
There's two issues that I'm seeing with your REST call. First, the error you're seeing is because the call needs to be preceded by "https://". Second, remove the interface IDs parameter and values. You should get a response with data after making these changes.
Your json looks erronuous (comma after the destIp) - and the server probably always responds with a default confusing error message in this case. (Postman is very well tested and it sends POST).