[TIPS] Salesforce REST API: The requested resource does not exist

By khoanc, at: March 2, 2024, 10:17 a.m.

Estimated Reading Time: 4 min read

[TIPS] Salesforce REST API: The requested resource does not exist
[TIPS] Salesforce REST API: The requested resource does not exist

Salesforce REST API: The requested resource does not exist


When working with the Salesforce REST API, one of the errors that can cause you to spend a lot of time fixing is:

[{ "errorCode": "NOT_FOUND", "message": "The requested resource does not exist" }]


Below are some possible reasons for this error, which you can check in turn to ensure you have implemented correctly and completely

 

1. Wrong Endpoint URL Structure 


a. Wrong API domain

mydomain.my.salesforce.com should accurately reflect your Salesforce instance's domain.

For example, if the Salesforce lightning you are using has the domain: https://domain1.lightning.force.com/lightning/page/home

Then your API should also have the domain: https://domain1.my.salesforce.com/


b. Wrong API Version

The API version in your domain is incorrect, for example, if you use version 60.0, the URL should NOT be for example /services/data/60.0/sobjects/Lead/listviews but /services/data/v60.0/sobjects/Lead/listviews


c. Object UnAvailability

Perhaps your object name is incorrect.

  1. You can check the list of standard Salesforce sObjects here (2) https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_list.htm
     
  2. And here is the list of standard objects  that you can access (3) https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_describeGlobal.htm.

Check if your sObject name used is in the API response above (3), if yes, then it's fine, but if not, there are two cases:

  1. Case 1: you are using the wrong sObject name, check again if the your object name is among those supported in the link (2) or not
     
  2. Case 2: you do not have permission to access that sObject, which leads to the next cause I will discuss below

 

2. Wrong Permissions

- To integrate with the Salesforce REST API, you need to create a "Connected App" in the setup page (you could find in: Setup dashboard > PLATFORM TOOLS > Apps > Connected Apps > Manage Connected Apps

- For that "Connected App", you need to assign it permissions to "Run as" a specific user in your org: Setup dashboard > PLATFORM TOOLS > Apps > Connected Apps > Manage Connected Apps > Your app name

Note:

  • Each user will be given permissions through a corresponding "Profile": Setup dashboard > ADMINISTRATION > Users > Your user > Profile section
     
  • Ensure that the Profile of that user has enough permissions to access the object in your API.

 

3. Record Existence

If you are accessing a specific record of an sObject, you need to ensure that the ID of that record exists in the list of records for the object.

 

Those above strategies are useful to troubleshoot the "The requested resource does not exist" issue when working with the Salesforce REST API. I hope it can be helpful to you, peace.


Related

Python Automation

[TIPS] Python - QR Code Exploration

Read more
Python

[TIPS] Python List

Read more
Subscribe

Subscribe to our newsletter and never miss out lastest news.