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
colingcoling 

API is not enabled for this Organization or Partner - w/clientId set for Professional Edition login

Hi,

In testing my (Partner) app with a Professional Edition account, I am getting an error logging in through the API (using PHP Toolkit 1.0.6)

"API is not enabled for this Organization or Partner"

The following PHP snippet shows that setClientId is called before the login::

$sf_client_id = "[Client Id supplied by Salesforce.com on certification]";

function sf_login($user_id, $wsdl, $username, $password) {
  global $sf_connection;
  global $sf_client_id;
  $loginResult = null;
  $errors = "";
  if (($username != "") && ($password != "")) {
      try {
        $sf_connection = new SforcePartnerClient();
        $sf_connection->createConnection($wsdl);
        $sf_connection->setClientId($sf_client_id);
        $loginResult = $sf_connection->login($username, $password);
   
        $location = $sf_connection->getLocation();
        $sessionId = $sf_connection->getSessionId();
      } catch (Exception $e) {
...
      }
...
}

The request sent is:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:partner.soap.sforce.com">
<SOAP-ENV:Body>
<ns1:login>
<ns1:username>[professional edition account username supplied]</ns1:username>
<ns1:password>[professional edition account password supplied]</ns1:password>
</ns1:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Request header:
POST /services/Soap/u/7.0 HTTP/1.1
Host: www.salesforce.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.0
Accept-Encoding: gzip, deflate
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 317


Response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>sf:API_DISABLED_FOR_ORG</faultcode>
<faultstring>API_DISABLED_FOR_ORG: API is not enabled for this Organization or Partner</faultstring>
<detail><sf:fault xsi:type="sf:UnexpectedErrorFault"><sf:exceptionCode>API_DISABLED_FOR_ORG</sf:exceptionCode><sf:exceptionMessage>API is not enabled for this Organization or Partner</sf:exceptionMessage></sf:fault></detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Can you help?

Thanks

Colin Goldberg


SuperfellSuperfell
You can see in your request that the clientId didn't appear as a soap header in the  request, that's why its failing.

Hopefully one of the PHP guys can tell you what you're doing wrong.