[TIPS] Salesforce REST API: The requested resource does not exist
By khoanc, at: March 2, 2024, 10:17 a.m.
Estimated Reading Time: __READING_TIME__ minutes
Quick Summary: The NOT_FOUND error in Salesforce REST API is often a "silent killer" of development time. Usually, it’s not about the code logic, but a mismatch in URL structure, API versioning, or permissions. At Glinteco, we’ve pinpointed the 3 most common causes to help you debug this in minutes.
Below are some possible reasons for this error, which you can check in turn to ensure you have implemented correctly and completely
1. Incorrect Endpoint URL Structure
The most common culprit is a subtle typo or a misunderstanding of how Salesforce constructs its API endpoints.
a. API Domain vs. Lightning Domain
Many developers mistakenly use the Lightning URL (which is for the browser) instead of the API domain.
-
Wrong:
https://yourdomain.lightning.force.com/
-
Correct:
https://yourdomain.my.salesforce.com/
b. The "v" in API Versioning
Salesforce is very strict about its versioning format. If you forget the lowercase "v", the resource will not be found.
-
Wrong:
/services/data/60.0/sobjects/Lead/
-
Correct:
/services/data/v60.0/sobjects/Lead/
c. Object Unavailability
Double-check if the sObject name is correct. Standard objects like Account or Lead are straightforward, but custom objects require the __c suffix.
-
Tip: Use the
/services/data/vXX.X/sobjects/endpoint to list all objects accessible to your current user.
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. Permission & Connected App Misconfigurations
Even with a perfect URL, Salesforce will return a NOT_FOUND error if the integrating user cannot "see" the resource.
-
Connected App Setup: Navigate to
Setup > Apps > Connected Apps > Manage Connected Apps. Ensure your app is configured to run as a user with sufficient API privileges.
-
Profile Level Access: Ensure the Profile assigned to the API user has the "API Enabled" checkbox checked and has Object-Level Security (OLS) for the target record.
4. Record Existence & ID Validation
If you are calling a specific record (e.g., /sobjects/Account/001XXXXXXXXXXXX), ensure the ID:
-
Exists: It hasn't been deleted or merged.
-
Belongs to the Object: You aren't accidentally calling a Lead ID under the Account endpoint.
Conclusion
The "Requested resource does not exist" error is a signal to slow down and verify your configurations. By following the hierarchy of Domain > Version > Permissions, you can resolve 99% of these issues.
Need help with complex Salesforce integrations or AI-driven CRM automation? Contact Glinteco’s Expert Team today to build robust, error-free API solutions.