Connect to Salesforce using Postman
HTML-код
- Опубликовано: 12 сен 2024
- In this video you'll learn that how you can connect to your Salesforce Org using Postman Rest Client. If you want to learn about integration, standard and custom Salesforce APIs then this is the very basic step you must know for that. If you liked this video, do share, subscribe and give your suggestions and feedback in comments below.
Linked Blog:- www.sfdcstop.c...
Update:- While you're using this approach make sure you don't have any whitespaces in any of the inputs and also that you're using security token appended with password.
P.S.:- If you're getting an 'INVALID SESSION ID' error, vivsas13 comment below may help you :-)
This is x100 more informative than the confusing and outdated Salesforce documentation. Thank you!
Glad it was helpful! Thank you George :-)
03:00 - Creating the Connected app on Salesforce
09:05 - Creating the requests on Postman
Brief and clean explanation and examples! Better than all the courses I paid for in udemy! Thank you so much! ❤️❤️❤️
You're very welcome Semiha 😊 Glad to know that you liked it...!!
Very nice. Thank you so much. Indeed it was a great tutorial. We really appreciate your efforts to make this for all of us in very easy way. I spent yesterday good amount of time in configuring above but failed. Reason, did not knew what is important and what to ignore. 1) Like you mentioned in case of grant_type password callback URL in salesforce connected app does not have any significance this is great t to know other videos did not mentioned that. .2) when using password grant_type we need to get access code using postman do it by post by passing url in endpoint and key value in headers not by passing param or going in options authorization. Basically some knowledge of postman is required like key value comes under param and it comes under header and also it comes under body form data as well.so following exact screens you show is very imp.
You're right Aradhika. I'll take care to keep more stress at the important points in future videos :-) Hope you resolved the issues at the end and were able to connnect to Salesforce via postman.
Amazing explanation and demonstration . I am a complete beginner and yet I was able to connect to data and extract from salesforce using Postman by following your steps.
Glad it was helpful!
Great Tutorial.. I am new to Postman and SalesForce and this was a lifesaver . But after I tried all the steps, I was still getting an 'INVALID SESSION ID" error when making the final API call. Googled for the issue and the issue was that in Postman 'Settings' the 'Follow Authorization header' was OFF. After turning it ON it started working. Would be great if you could add that point also into the video.
That's amazing vivsas thanks for sharing, I have never faced such issue so was not aware of this. I'll highlight your comment in the video description 👍
This is a life saviour comment specially when you are new to Postman. Thanks @visvas13 :)
@@sfdcstop But ideally we should not face this issue, i assume it should work without this feature being turned on. Could it be some session settings in salesforce?
This is only the case with postman, I think. Even I haven't faced this issue when I called the API using postman itself. It's coming to some users because of their postman settings.
Thanks!! Salesforce documentation is garbage, after 8 hours of confusion this solved the problem for me in 5 mins.
Thank you for providing a clear teaching. I will be sure to share.
GReat explaination brother , clean and crisp to the point.
Keep up the good work
Thank you brother, will do!
Rocking Video Rahul ji
100 times better then others and more informative.
Really too happy after watching this video
😎😎
Glad to know that you liked it Anshul Ji, Keep Learning 😃
Great Job! People like you make the lives of developers easier.
You are good at explaining things in a simpler way without compromising on detailing. I would urge you to start your udemy courses
Hi Deepak, thank you for the suggestion. I'll try to create one :)
Nice Tutorial Rahul. Keep up the great work :)
Thank You for your feedback Sanjay..!! Make sure to share it in your network too 😊😊
Clear cut understandable more than others , Thank you
That was a simple superb and sweet session😊👍🏻
Nice Tutorial Rahul thanks to solve my query which I was looking. One query only can we call salesforce Apex Rest API Integration with postman?
Yes, you can call your custom apexrest api from postman
This is so simple and easy to understand video
Glad you think so!
Thanks for your video and the web page.. saved my day!! Thanks a lot sir.
Glad it helped!
Nice explanation , can u make video on authorizing postman to salesforce using Authentication code flow as well. Thanks for your Contribution. Is it possible with postman ,if yes then will the server(salesforce here) will respond with authorization code in that case instead of direct access token as response to 1st POST request? and then postman will have to do 2nd POST request along with this Authorization code to get access token?
Hi Manish, I recently added a video on Authorization code flow too, you can watch it here: ruclips.net/video/jQydnOaifng/видео.html
Very Nice..Explained it in a very well way.
Happy to know that you liked it Vini 😊 Make sure to share it in your network too...!!
Nice explanation. Thanks
thank you SFDC Stop very informative and helpful
Glad it was helpful!
Thank you so much for this video. Easy to follow and learn . Great tutorial
Glad you liked it buddy. Do share it among others as well 😊 #KeepLearning
In case you are getting this error while doing GET call from postman : [
{
"message": "Session expired or invalid",
"errorCode": "INVALID_SESSION_ID"
}
]
use this solution -> Setting -> Turn on 'Follow Authorization header'
Hello Rahul Sir
You doing very good.
But when I am trying to Post same data then a error
Returns. Invalid header type
Hi Anshul, maybe you're not using a post request or there is something wrong with the request header. Can you try again?
@@sfdcstop thanks for your reply there was a simple syntax error
Good Session. Thanks for sharing!
Helpful confident clear clarity
Superb explanation ..Very lucid ..!! Thank you so much.
So happy to know that you liked it Aditya 😁 Make sure to share it in your network too...!!
@@sfdcstop Done already..!! :)
Fantastic! You did a great job explaining this. Thank you so much :D
Glad it was helpful!
Thanks for the info.
Great Video tutorial thanks for the help!
Glad it helped 😊
Thanks .. one quick question - Can we do it by 'basic authentication' instead of 'Connected app/oauth' ? . Does SFDC not support basic authentication ?
Hey Arijit, as per my understanding, Salesforce doesn't support basic authentication. However if you still need to implement such use case I prefer to create a public site and implement a custom basic auth by yourself for any requests to that site.
thank you for this video, it is very valuable
Very well explained!!
Thank you Bro!
Your videos are really helpful! Thank you so much for such wonderful explanation. Could you please create a video on how to integrate Salesforce with SAP? That's my request.
Hi Ananya, Glad you find the videos helpful! I can create one but I don't have access to any SAP environment as of now. Meanwhile if you've any specific queries, feel free to add those in comments or on our group: t.me/sfdcstopdiscuss
Thank you for replying. No I just wanted to know how salesforce can be integrated with any third party system. Not necessarily SAP, but any third party would do. Actually I am quite new to integration, hence requesting you if you can create any video like that, it would of great help! Thanks a lot again!
Usually REST APIs are used for that purpose. This tutorial series will teach you all the basics about that:
Salesforce Integration Tutorial Series: ruclips.net/p/PLuL63vr-9xHzI83rrXaXHDcsfVqzrp0iO
Ok great! Thank you!
Just one question, instead if passing parameters as form data in request body, can we send those parameters as combined in json format?
Hi Shrikant, when we're passing the parameter in the request body, we're actually sending them in form-data format. I am not sure if JSON input is supported by standard APIs or not but I guess it does, give it a try yourself and let me know if you face any issues :-)
Thank you for sharing
Hi, I am kiranmai thank you for your valuable msg I had one question that can you give tutorial on how the postman tool is connected to market live chat in sales force who to create lead and engagement
Hi, I have not worked on that actually, if you can share a doc or something maybe, I can create a tutorial in future.
Even after using security token with password, i am not able to move ahead.
I am getting error as {"error":"invalid_grant","error_description":"authentication failure"}
Hi Swaraj, make sure there is no whitespace in any of the input while you're making a request. Please try again once and let me know how it goes.
Hi, Your Video was so helpful. when I tried the same, I am getting "error": "invalid_grant",
"error_description": "authentication failure" even after passing the Security token. Could you please suggest any way. Thanks in advance
Hi Vivek, I personally faced this error message when the connected app wasn't prepared (it takes 5-10 mins to be ready for use). If everything is correct on your side (no white spaces in request params), wait for some time and try again. It should work.
I saw you created a callback URL, but I don't see it being used anywhere. What is callback URL and when is it used?
Hi Loc Le, the callback URL is mainly used in Authorization Code Flow which is server to server connection. Here, I've demonstrated the username-password flow i.e. server-client connection, the callback URL in auth code flow is mainly used to append the authorization code which is appended at the end of the callback URL of your server. The code is then used to again make a request and in exchange we get the token. You can have a detailed look here:- help.salesforce.com/articleView?id=remoteaccess_oauth_web_server_flow.htm
Thank you buddy, you save my day
Glad I could help!
Hi Rahul,
Do we need to provide Access token while performing actual callout?
Hi Manisha, Yes...!! Access token is required when you're connecting to salesforce from external system.
@@sfdcstop
Hi Rahul,
1. Could you please let me know where is the access token part in the code.
2. Do we need to do it once or for every user?
Hi Manisha, it depends on which language you're using in your external application to connect to Salesforce. If you're using the client-server way then the process will be the same, first get the access token and then call the required API. I would recommend using the server-server connection if possible.
The user whose login creds are used to get the access token will be marked as the user for any Operations in Salesforce through API.
Hi Buddy,
thanks for session. I am already working on salesforce test instance in my org but I have a doubt.
I have created connected app and I am able to play. around with the Auth token which I got it from above.
but users in my organisation is unavailable to login in a sam way as it is giving them authorization error.
Only difference is that I am system Administrator user and others not.
Question:
How can I make other colleagues in my org connect ?
what settings should I change to allow users to access my connector app which I have created.
Can I connect with you on call if possible?
Thanks,
Hitesh
Hi Hitesh, we usually create an integration user and give that user access to the connected app using a permission set. So, you can follow the same approach :- create a permission set and link it with the connected app and also link that permission set with the users that you want to interact with your org and they'll be able to generate token. In case you still face any issues you can DM me on telegram or join our group here:- https;//t.me/sfdcstopdiscuss
@@sfdcstop as I checked it said there is no group name in Telegram, can you add me my id is @hitesh195 ?
@@cool120326 Done buddy
Very useful.thank you
Fantastic
is it possible to apply REST API for trial version of Salesforce?, i have 30 days of access to salesforce
I am not sure but don't think so. Try using a developer environment instead: developer.salesforce.com/signup
Thanks Man :)
Hey !! Is this whole integration playlist is updated ????!!Can I learn this ??
Hi Sitesh, I haven't added any new tutorial in the meanwhile, but yes you can still use it because nothing is updated in the concepts explained that I am aware of.
Nicely taught... I have a question.. you said it is easier with username password flow, rather than the authorization code flow.. I saw other videos using authorization code flow and I felt, it was much easier than this username password flow.. can you please tell me what could be the reason?
If you felt that easier. Go for it...!!
@@sfdcstop i only wanted to know if there is any r reason for it ... does it make any difference and if there is any specific situation we need to use them
For server-server communication -> use authorization code flow.
For server-client communication -> use username password flow.
hii,
I'm still stuck with this error
what does it mean ??
{
"error": "invalid_request",
"error_description": "must use HTTP POST"
}
Hi Ajit, maybe you're using the GET or any other method in your request insted of POST. Can you check it?
Hi
I'd followed all the steps accordingly as described in the video but it still giving the error, even though I have added Security token along with my passowrd, also have checked for white blank spaces.
{
"error": "invalid_grant",
"error_description": "authentication failure"
}
Can you please help me out ASAP.
Thank you
Hi Mustafa, there should be no issues then if you've checked. Can you send me a DM:- @rahulcoder on twitter or @imrahulmalhotra on instagram and we'll resolve that issue.
Hi I have a problem. Does it exists another method we can use without getting the token of the user to connect or having access token. from Salesforce.
Yes you can use server to server authentication. This is client to server auth
Very useful. Thanks
Glad to know that you liked it buddy. Keep Learning...!!
Perfect explanation
Thank you for your feedback buddy, do share it in your network 😊
I have tried the following steps.. could able to generate the access token and was able to access the versions using this url.. this is working fine.. but when I append some other it is not working... And also what is the use of the sample URL which was given at the time of creating connected app...
Hi Anudeep, what do you mean by some other here ? If you're talking about the callback url that we added in connected app then it's useful when we have a server to server connection. Here postman is a client so we can give any url as we're having a client-server connection. Have a look at my other video in which I have explained how to connect two Salesforce Orgs. I have given a specific callback url there and not any sample URL
@@sfdcstop Thank you..this helps me to understand.....
can you please make a video on how to connect to salesforce from postman in case of 'single sign on' login in salesforce. How to get the access token in this case?
Sure, Please add your suggestion here:- www.sfdcstop.com/p/what-do-you-want-us-to-post-next.html
good explanation !
Thank you for this video. Extremely helpful. I manage to connect and get access token however, when using Oath 2.0 authorization, I get 'Invalid Session ID'. Am I missing something? Thank you.
Hi Felix, when are you getting this error?
@@sfdcstop I get this error after get changing the authorization from "Inherit auth from parent" to Oath 2.0 and setting up the available token. When I do get new token tit executes to success but when I try sending a subsequent request I get Invalid Session ID
Can you share how you're setting the existing token in the request? Maybe something is missing there as you should be able to use existing token easily.
Awesomeeeeee!!!!
Hi Rahul, What happens if i change my password?Do I have to inform my third party every time while changing?
Hi Karthik, you're right you need to notify the 3rd party each time the password is updated. For this purpose, we usually create a separate Integration user into the org and share that user's creds.
@@sfdcstop thanks rahul.makes sense
Very good explanation however i'm not getting what to provide in Callback URL
Callback URL will be used only when you're following a server-server authentication. Here we're having client-server auth so you can add anything for the callback url as we're not using it.
Thank you so much!
Glad to know that you liked it Tejender, do share it in your network too 😊
You are awesome
Can I get Your Notes sir ... which is very helpful to me ...pls
Hi Vaibhav, the related blog's link should be in the video description. You can check that out!
@@sfdcstop ohk
Hi, For me its showing
Bad Message 400
reason: No Host for checking access_token ,Can you help me?
It usually occurs when the request syntax is not correct. Can you check you've the exact client id and secret and you're making a post request from postman?
I am getting issue :- {
"error": "invalid_grant",
"error_description": "authentication failure"
}
lifesaver
If you create a connected App in dev Env when you deploy it in the test env the clientId,Client secrete Id, Passowrd, Username will remains same because in test endpoint will be test URL?
Ideally you should not be able to deploy such an app with client id/secret or a new client id/secret should be generated
Thanks a lot!
Happy to see that you liked it. Make sure to share it in your network too 😊😊
How to use query with filter condition or sub query ..can you give the example
Hi Vijay, I think you can directly try placing a subquery here instead of a query and it should work fine, as the query API should be able to deal with any type of queries
@@sfdcstop I am getting 411 length required for content length when trying to hit sales force api
@@sfdcstop is there any limits for hitting the sales force application API from postman?
Please make sure you're using the GET method
Thanks for the video. I am able to generate access token but getting below error while sending query
{
"message":"session expired or invalid"
"errorCode":"INVALID_SESSION_ID"
}
Hi Akshata, maybe you're adding some whitespace in the authorization header token while making the request, please make sure you copy the token without any whitespace and try again.
@@sfdcstop I have verified, not adding whitespace in Authorization header. But still getting same error
Usually there is a whitespace issue only when this error appears, can you check if you're sending the request to the correct url ?
after attaching the security token also i am getting the same authentication failed error
Please help
Hi Arun, Please check for whitespaces.
Hello
I followed the steps you mentioned. However, am getting the following error
Note: I did add the security token to the password
{
"error": "invalid_grant",
"error_description": "authentication failure"
}
SOLVED : Changed the password without any special characters after which it started working
Great Jatin, thanks for sharing. I guess it was a whitespace issue because maybe you copied and pasted the password in postman
@@sfdcstop No, it was not paste and copy issue. I confirm that it was because of special character in the password
Hi , Thanks for the video but i am getting an error
{
"error": "invalid_grant",
"error_description": "authentication failure"
}
Can you please help me out? I have used grant_type password
Hi Sachin, can you please check if there are any white spaces in your input that you're sending through postman ?
@@sfdcstop I was filling the wrong password, :D MY BAD thanks for the great video, looking forward to more videos.
I tired but I didn't recieve any token can u say why? I didn't get token @sfdc stop
{
"error": "invalid_grant",
"error_description": "authentication failure"
}
400:The request cannot be fulfilled due to bad syntax.
Can you please help me out? I have used grant_type password
This is a generic error so there can be multiple reasons. Please make sure that you're using the right client id and secret with no whitespaces, you're using a post request and have used security token as well along with password
it was perfect
Error:
Error 405 Only POST allowed
Hi Aniket, I think the error message is itself descriptive...you need to do a post request instead of a get.
I see the access token. But where is the refresh token??
Hi Biswajit, this is the implementation of username-password flow, we don't get refresh token in this flow. You need to implement web server flow in order to get the refresh token.
Can we create user account by Salesforce API call via postman?
Hi, I haven't tried that but I think it should be possible we can try treating the user as a normal object and posting the relevant data there to create the user. Have a look at this for reference.
developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm?search_text=user
We can create a user in scratch org and that's also created by hitting an api so I think you can use the same json format while trying to create a user which can be found here:- developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_users_def_file.htm
Hope that helps..!!
@@sfdcstop I will update you.. actually doing it on test environment on Developer Edition. How I can be in best tough with you for my querries?
Join our telegram group:- t.me/sfdcstop
@@sfdcstop shows not available
Just search for @sfdcstop on telegram and you can join the channel and group there.
can we do the same for Basic Authentication instead of Auth 2.0 ?
Salesforce doesn't support basic auth
Can we pass query parameters for POST method without code ? I want to pass JSON data to salesforce.org using a URL only. The requirement is to avoid code and send data by using a URL.
Hi Shiva, I think a GET request should work fine in that case, you don't need a POST request for this.
Thank you
You're welcome buddy!
Hi, I have done exactly what you have shown in the video and also in the link that you have provided. but unfortunately, I am getting stats: '411Length Required'. I am doing a 'get' call. I see that 'Content-Length' is and I don't have the option to set it manually. I am not able to finish the get-call. Please help me. Thanks, Shashanka
Hi Shashanka, can you tell me which API you're trying to hit from postman? Have you tried the callout from any other tool or cURL?
Nice Tutorial but i need to know how to upload and download Files From SFDC through postman
Thanks Rakesh, It depends if you're using a standard or custom API and what is the file size.
SFDC Stop can you please provide video to load CVS file on SFDC
Error: getaddrinfo ENOTFOUND creative-impala-do5h1i-dev-ed.salesforce.com
getting this error when trying to post lead from Postman
Please check your internet connection once and try again
@@sfdcstop tried but still same error persists
@@sfdcstop resolved it as given URL wrong but now facing Session expired or invalid error. Guess the auth token is expired , how can i solve this problem??
Are you using security token appended with password ?
@@sfdcstop yes i am using password +token
thanks alot....can some1 help me out with url to send mail whenever we insert,update or delete data in postman tool which is connected to salesforce through connected app
Hi Varsha, in order to send an email you can create a custom REST API which will call your apex method and you can have your email logic written in your apex method. You can checkout the integration tutorial series Part 1-6 to understand how you can build your custom APIs in salesforce
@@sfdcstop thanks alot for info
hey I'm getting like this what to do
{
"error": "invalid_client_id",
"error_description": "client identifier invalid"
}
Sometimes connected app take some time to get ready to be used. Have you waited for 10 mins and tried again?
unsupported_grant_type","error_description":"grant type not supported" is the error that I'm getting as well. I'll seek help from you on IG
Hi Jarvis, I think I missed your message on IG, will check and reply to that.
At last I am getting this ,while executing this get api SELECT+Name,Type+FROM+Account , :
{
"message": "TotalRequests Limit exceeded.",
"errorCode": "REQUEST_LIMIT_EXCEEDED"
}
You've exceeded the API limit of your Salesforce Instance. Try again after 24 hours and it should work
@@sfdcstop for this api or any of the api, I am getting the same error everytime, haven't got the result single time
The limit is exceeded for all the APIs not only this one. You can try again later
@@sfdcstop thank you, I will check again after 24 hrs
It was nice session. could you please let me know how can I able to login to salesforce throufgh using PHP Curl
Hi Sowmya, just use the same method by calling out two different URLs in Curl. One for getting token and another for hitting actual api by keeping the token obtained from previous request in header.
@@sfdcstop Thanks Rahul! Very Helpful tutorial. Can we generate the token in Postman using above steps and use it in some other application? Will that work? Or token has to be generated from that application only which is going to make the Api call?
@@pujamaheshwaripoddar6017 Hi Puja, yes you can generate the token and use it in other application and it'll work but be careful as every token comes with an expiry limit. So, once it's expired, you can't use it anywhere.
@@sfdcstop Thanks so much for your prompt reply Rahul! Can you please guide me how do I get token which never expires? Not sure just changing the "Refresh Token Policy:" to "Refresh token is valid until revoked" will help. I need to provide a token to an external client who will update some fields on one of our custom object. If you can point me in any direction that will be very helpful as now when I am testing with my above token I am also getting INVALID_SESSION_ID.
Just to add I need this token for automation. I am little confused here. Do I need to generate the token myself which never expires or I need to provide them the api user and pwd along with Client id and secret and they will generate and refresh the token themselves. I thought I can just provide them the token and that way I won't need to share above sensitive info with them. I have a feeling they will have to handle this. Please advice if I am on a right track or not. Generally how it works when we integrate SF with other systems?
you save my live
Please give me u r blog details ,thanks
https;//www.sfdcstop.com
Work on your accent, for the love of god.
Haha...thanks for your feedback john.
SFDC Stop Your accent is cool 💙