0

I am working on an assignment where I need to pull specific fields on the contact object with metadata api using Postman or SoapUI.

The metadata api works fine from Salesforce workbench using the below URL.

/services/data/v43.0/sobjects/Contact/003xxxxxxxxxxxxx?fields=Id,Name,FirstName,LastName,Title

I did setup a connected app, an integration user in Salesforce. Also, from SoapUI or postman, I am able to get the OAuth access token successfully using the client id, client secret and the credentials of the integration user. However, when I submit a GET request from SoapUI or Postman, I am getting either a "Session Invalid or Expired" or "The requested resource does not exist". The URL that I am using is below.

https://test.salesforce.com/services/data/v43.0/sobjects/Contact/003xxxxxxxxxxxxx?fields=Id&access_token=00xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxwrfyQUftcOwmNXMgIecxkX6YiYNW5rcW7mtSG.

If I put the access_token in URL, I get the Session Invalid message. If I put the access token in the auth header, I get the message 'The requested Resource does not exist'.

I have tried several different options, but I am not getting the result that I get in workbench.

Any thoughts?

  • silly question, did you give your connected app proper permissions for the object? – Sebastian Kessel Oct 23 '18 at 22:20
  • I gave the "manage and access data" permission to the Connected App. The profile of the user has access to contact object. – Balaji Pooruli Oct 23 '18 at 22:32
  • I was able to get it working as mentioned in Jayant Das's response. I have created a new profile as "Basic API User" which has the permissions "Call Apex Rest Services", "API Enabled" and "API Only User". The REST API call thru postman is working only if I enable the permission "View All" on the Contact object. I was thinking of re-using the same profile for future requests. So, I created a permission set and enabled the "View All" on Contact object and permission to Connected App. However I get "Requested Resource does not exist" when calling REST API. Any thoughts? – Balaji Pooruli Oct 24 '18 at 10:47
1

Here's how you do it.

Few things to note.

  • You are trying to hit the REST APIs and not the Metadata API here.
  • Make sure you use the instance URL to make the callouts. E.g., if my instance name is say https://myinstance.my.salesforce.om, any API callout that I will make will be as https://myinstance.my.salesforce.om//services/data/v43.0/sobjects/Contact/...

POSTMAN

  1. Use a GET request with the URL
  2. Set the Header with key as Authorization and value as Bearer < auth token >

    Refer to screenshot for details. enter image description here


SOAP UI

  1. Create a new REST Project in SOAP UI with your API endpoint
  2. Set the Header with key as Authorization and value as Bearer < auth token >

    Refer to screenshot for details. enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.