Inserting Records in Account or (any other sObject) Through Postman in salesforce

Force.com platform support powerful web services API for interaction with external app and salesforce.com . For secured interaction with third party app, Salesforce enforces authentication process.

We are using postman from API testing and request management to hit api by get or post and received data in the form of JSON and XML.

We can also add a record from postman to our Salesforce org.

Install the postman from here.

Download URL :- https://www.getpostman.com/

We’re going to use OAuth2 and the authorization code flow.

Step 1: create your connected app

  • Inside Salesforce setup, navigate to Build > Create > Apps.
  • In the bottom panel of the page, where it says Connected Apps, click New. This will open a dialog to create a new connected app.
  • In Name, type “Postman”, and supply a mandatory contact email
  • Make sure Enable OAuth settings is ticked.
  • As an additional step, you need to ensure you add https://www.getpostman.com/oauth2/callback to the callback URL list (see below). This is the Postman endpoint that will receive the token.
postman1.png
postman.PNG

Step2: OAuth with Postman

Postman has built-in OAuth-base authorization. In Postman, click on the Authorization tab and select “OAuth 2.0”.

postmann.PNG

Click on Get New Access Token to launch the OAuth dialog. Use the following values:

Token Name:  My Postman Token or (Any name)
Auth URL: https://login.salesforce.com/services/oauth2/authorize 
Access Token URL: https://login.salesforce.com/services/oauth2/token 
Client ID: (the consumer key from your connected app)
Client Secret: (the consumer secret from your connected app)
Scope: (you can leave this empty)
Grant Type: Authorization Code

token.PNG

Click on Request Token. This will take you to the Salesforce login screen, where you can type your credentials.

postman4

Click on Use Token and in the Add token to drop-down, select “Header”, so that the token will be added to the HTTP request headers. You’re now ready to call your web service.

Make the request

https://sgpgroups-dev-ed.my.salesforce.com/services/data/v39.0/sobjects/Account/

Regarding inserting an Account in Salesforce, you have to POST a JSON request like this

{

“Name” : “Phaneendra Test”

}

Click Send.

postman5.png

Get Status code 201 Created.

Get record Id.

And “Success”: true,

It will create a record in salesforce org.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Please check your mail for confirmation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Select Language »