function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
faraz aleem 9faraz aleem 9 

get rid of REST API NOT ENABLED error message

My website is developed in PHP and in my website, there are list of users. I give this option to my website visitors that they can click on any user and save it as a lead in their sales force account. To acheive this , i created a dev account and created an API on salesforce developer account. Then i am using REST api and written all the code. Now when as a visitor i open the website and click on the user to store it as a lead to my salesforce account, it gives the error 

"Error: call to URL https://ap2.salesforce.com/services/data/v20.0/sobjects/Lead/ failed with status 403, response [{"message":"The REST API is not enabled for this Organization.","errorCode":"API_DISABLED_FOR_ORG"}], curl_error , curl_errno 0"

How can i get rid of this message as i can't ask visitors of my website to enable RESPI API in their account first. This is what i ideally want, when visitor who have his salesforce account, click on any user, it should ask for visitor's username and password and permission, and on approval it should store the user as a lead to his account without asking visitor to enable API in his salesforce account. Please help me out how can i fix this, as i am running out of time and i am looking for quick help. Thanks.
 
JeeTJeeT

Hi Faraz, 

Have you created a connected app? if not, please follow 
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_defining_remote_access_applications.htm (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_defining_remote_access_applications.htm" target="_blank)
after creating an connected app, customer id will be generated by salesforce.
Use this id with your rest callout url to invoke salesforce services. Let me know if you have any other cincern.

faraz aleem 9faraz aleem 9
Hello JeeT,
Thanks for your response. Yes i created the connected app and received the customer ID and yes i am appending that with callout URL, i am then trying to add a contact as a lead in salesforce, but i am receiving below response:

"Error: call to URL https://ap2.salesforce.com/services/data/v20.0/sobjects/Lead/ failed with status 403, response [{"message":"The REST API is not enabled for this Organization.","errorCode":"API_DISABLED_FOR_ORG"}], curl_error , curl_errno 0"

Is it something to do with my account which is a developer account ? When i have Enterprise account and receive customer id for that account, then i will get the REST API access ? I am new at salesforce and having these few questions.

 
JeeTJeeT
Check your profile access whether it has 'API Enabled' setup-> manage user-> chose your profile(associated with the username used for rest service) -> follow the below image.
API Enabled? 
or
check under the "Standard Object Permissions" whether you have write permission to Lead object or not.
Read Write Permission
faraz aleem 9faraz aleem 9
I gone to Setup -> Manage User and clicked on my profile. It opens complete user details with name, alias, Role etc, but there is no info as API Enabled on this page.Is this checkbox present on free user account or only on enterprise account ? Because that could be the only reason of why i am not seeing API Enabled checkbox.
JeeTJeeT

Hi Faraz,
Please find name of the profile of your login,
How? from the top right drop down of salesforce platform(named as user menu), click on my settigns -> from the left side quick find search box, search for 'Advanced User Details' click on the link -> it displays the enire user details -> from the details you will also find which profile u have been assigned, click on the profile link. another way of finding a user profile(follow https://help.salesforce.com/HTViewSolution?id=000005239 don't change the profile). then find that above sceenshots to verify, if you don't have the access ask your admin to previleged to you.

let me know, if you have some other concerns