0

Hi i am able to get OAUTH token using below article,but i need to send POST method for Accounts using Salesforce Tooling API On Postman

i am using v45.0 version of salesforce,can some one tell me what should be below things:-

1)Rest end point for standard account object which needs to be hit using Postman 2)Body json payload which needs to be sent along with Rest endpoint Postman

I tried sending mandatory fields of Account object but got 404 status code that is Bad Request, Please help me in building a rest end point curl command for standard salesforce Account object

https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_rest_resource_examples.htm

Thanks In advance, Carolyn

Carolyn Cordeiro
  • 1,525
  • 3
  • 11
  • 26
  • What do you need to accomplish? Create/update accomplish accounts? Tooling API is for working with metadata (learning what objects there are, what fields they have, running tests, deploying stuff). You need to extract info about Account table or manipulate data in it... – eyescream Oct 10 '20 at 18:28
  • For testing ,need to send curl request to account object so as to update data in it,right now using salesforce inspector plugin but don't want to use it because we need to automate this ,hence looking to insert new accounts using PostMan,was able to send SOQL query but unable to send post request to Account object – Carolyn Cordeiro Oct 11 '20 at 00:09

1 Answers1

1

If you have basics sorted (you can log in and query successfully from Postman) it's bit easier to explore the APIs using Workbench -> Utilities -> Rest Explorer https://workbench.developerforce.com/restExplorer.php

Or - bit more work but will pay off once you set it up - you can download a collection of Postman API calls for many things you could need: https://github.com/forcedotcom/postman-salesforce-apis

Anyway. Ditch the tooling api, use normal rest api.

To insert single account

send POST

to {base url you got from login result}/services/data/v49.0/sobjects/Account with body similar to

{
    "Name" : "Foobar Inc.",
    "Website" : "http://example.com",
    "NumberOfEmployees" : 123
}

(you might need your own required fields but generally it should work)

Response will be something like

{
  "id" : "0014u00001ojYsQAAU",
  "success" : true,
  "errors" : [ ]
}

You can also send up to 200 records in 1 message, create account and related contacts in one go (useful because it saves you some headache mapping ids - and if one of contact fails to load you may want to undo the whole operation, not be left with orphan/widow records). Check https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_composite_sobject_tree_flat.htm out and other links from same chapter

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Good answer ;) also you can update multiple records using https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_update.htm Basically the Tooling API is for Metadata and Rest API is for records – Bartheleway Oct 11 '20 at 20:03