0

I am trying to connect to the metadata Api via a python script. Essentially, I am authenticating into the SOAP Api, getting a session Id, then setting the session if in my Metadata client class. This works well for production orgs but when trying to connect to the metadata api for a sandbox, I keep getting an "invalid session id" error. Perhaps the URL is wrong? If so I cannot figure out how to set it.

Thanks in advanced!

  • 2
    Are you using test.salesforce.com Or login.salesforce.com url? – San Aug 12 '15 at 19:07
  • does the user is api enabled and has modify all data permissions in the sandbox? – Goki Aug 13 '15 at 2:06
0

To set uRL you can use below sample code

final LoginResult loginResult = loginToSalesforce(USERNAME, PASSWORD,

private static LoginResult loginToSalesforce( final String username, final String password, final String loginUrl) throws ConnectionException { final ConnectorConfig config = new ConnectorConfig(); config.setAuthEndpoint(loginUrl); config.setServiceEndpoint(loginUrl); config.setManualLogin(true); return (new EnterpriseConnection(config)).login(username, password); }

from the loginResult you can get the session id.

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.