Getting error while making access token request from Headers (Postman) - api

While making access token request from Headers, I'm getting below error.
Error-
{
"error": "unsupported_grant_type",
"error_description": "grant type not supported"
}
Am I doing something wrong or missing something?
Please help!
Attached screenshot-
enter image description here

You used wrong tab.
Headers should be just 1-2:
Content-Type:application/x-www-form-urlencoded
Accept:application/json
Your actual params are supposed to go to the body. Which you can type in manually or in postman's bulk edit syntax it'll be
grant_type:password
client_id:3MVG97sr...
client_secret:CE6C05...
username:example#example.com
password:Hunter2
If you're stuck - edit your question with the postman's "code" output (HTTP or cURL are probably best for wider audience to help you), just edit out the sensitive bits.
P.S. Check https://github.com/forcedotcom/postman-salesforce-apis out. It's bit more work to set the environment variables up, create an account with Postman to fork the repository... But in the long run saves reading documentation and typing all calls by hand.

Related

Unable to use the Dialogflow CX REST API

When testing the dialogflow API on postman, I am getting a 404 error even though I have specified the correct URL while providing the correct parameters for the parent values. Authentication is also validated.
Any help would be appreciated.
For references, here's where I tried to retrieve list of environments from my agent Heres a pic of the problem. I have provided variables for the ID values
I am getting the same error for most of the endpoint values. It is however working on the detectIntent one
Nevermind, I got my mistake. I didnt remove the '{parent=}' from the URL, apparantly the curly brackets are part of google's naming convention.

Replicating POST request in POSTMAN

I'm trying to use Postman and replicate the following POST request from this link:
https://www.msc.com/en/track-a-shipment?params=dHJhY2tpbmdOdW1iZXI9YXNkYSZ0cmFja2luZ01vZGU9MA%3D%3D
The payload necessary to get a response from this API is something like:
{trackingNumber: "asda", trackingMode: "0"}
With the following payload, I expect to receive the following response:
{IsSuccess: false, Data: "Container not found"}
Here, you can see my Postman request:
All I seem to get from this is an empty string, which is not the same result I would see If I checked my Network tab from developer tools.
I'm wondering what do I need to do in order to get the same result. Change headers? Change payload format? What else could it be?
The request works for me, what's the difference that depends. But the easiest way to find the correct answer is to import the request as is from the Developer Tools.
Find the request on the request list and click Copy as cURL (bash):
Then on Postman click Import (top left main window) and select the Raw Text option:
The request will be on the current window and you can just click Send:
So you can now diff your request with this one. There's a lot of headers so I would remove them one by one and see where the request fails. Without having the API at hand, this is really a trial-and-error exercise.
Hope this helps.

How do I use/read an api documentation to send a simple request?

I know this is probably strictly case-specific, but I do feel like I encounter this problem a lot so I will make an effort to try and understand it better.
I am new to using APIs, but I have never succeeded in using one without copying someone's code. In this case, I can't even find any examples on forums, nor in the API documentation.
I'm trying to pull my balance value from my investment bank "NordNet" to scroll, amongst other things, on an Arduino display I've made. Right now I use python Selenium to automatically but "physically" login to NordNet and grab my balance from the DOM. As I'm afraid I might get "punished" for such botted behavior, and because the script is fairly high maintenance (as the HTML changes over time), I would obviously much rather get this information through NordNet's new API.
Link to NordNets API doc
Every time I try to utilize an API doc it's always the same, it looks easy, but I can never get it to work.
This time I tried to just play a little with the API before exploring further.
I use PostMan to send the simplest request:
https://www.nordnet.se/api/2
And I get a successful code 200 JSON response.
I then try to take it a step further to access my account data using this endpoint:
https://www.nordnet.se/api/2/accounts
For this one, I obviously need some authentication of some sort
The doc looks like this:
So I set my PostMan client up like this and get the response showcased:
I've put my NordNet login into the "Auth" tab as "basic auth" and I then see PostMan encrypts this info some way, in the "Headers" tab.
I'm getting an unauthorized response code and I have no idea why. Am I using PostMan wrong (probably)? Is the API faulty (probably not)? There is a mention of a session_id that should contain both password and username? Maybe something completely else...
I hope you can help
The documentation says to use session_id as username and password for that api ,
so try logging in and then get the session id (try with both sid and ssid) . from network tab and pass it as username and password for authorization .
sid- is for http and ssid for https i guess , try with both

wkhtmltopdf specifying authorization header

Need to send a header to get past security to take a screenshot of a page using wkhtmltopdf. I need to send a header the looks like:
"Authorization=Basic " + some base 64 set of characters.
for some reason nothing I do works... I've tried
--custom-header "Authorization" "Basic ectectect"
--custom-header "Authorization"="Basic ectectect"
--custom-header "Authorization=Basic ectectect"
Some help would be appreciated... the documentation is not so good.
So I know this question is old, but I just had this problem and of the 2-3 mentions of it anywhere on the web, no answers were found. In my case, I was calling a page that makes an ajax request to load data. Without using --custom-header-propagation, the authorization header I specified wasn't being propagated to this subsequent ajax request, which is why it appeared to fail with an authorization error.
Try:
Authorization "Basic tokenHere"

Google Spreadsheet API: Post request fails

I have a Google spreadsheet published to the web, and I'm trying to read and write list-based feeds. I have not authenticated.
I can read data using a GET request just fine.
curl https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDsadfwerF4RE0M/1/public/full
However, all my post requests to write data come back with an error
curl --data '' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full
curl --data '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:id>1</gsx:id><gsx:status>1</gsx:status><gsx:user_email>1</gsx:user_email><gsx:url domain>1</gsx:url domain><gsx:highlighted_text>1</gsx:highlighted_text><gsx:complete_text comments>1</gsx:complete_text comments><gsx:created_date>1</gsx:created_date><gsx:updated_date>1</gsx:updated_date><gsx:created_by>1</gsx:created_by><gsx:updated_by>1</gsx:updated_by></entry>' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full
The error I'm getting is: "Sorry, the file you have requested does not exist. Please check the address and try again."
Do POST request require authentication? I can't find anything in the docs that say so.
Any help would be appreciated. Thanks.
Two things:
I think you need to use the private feed (.../private/full), not the public one (.../public/full) like you're using now. More on the private-versus-public distinction is in the API docs.
You will need an Authorization header. (That process gets pretty complicated, but there's a lot of good info here. Remember to select the appropriate scopes.)
Both are mentioned in the example about adding a list row in the Sheets API docs. (I'd link directly, but I don't have enough rep to add more than two links. Just search for "Adding a list row".)