Getting the instance url of the user at the time of login in REST API


I'm integrating SugarCRM into our product. Currently I'm using the trial version. It seems that each account has an instance url, but I seem to be needing the instance url for login.

So, if a user connects their SugarCRM account in our product, how can I get their instance url for login. SugarCRM doesn't seem to need app creation for integrations, so there's no point of creating my own account and using that url.

For example, Salesforce has a common endpoint for login which gives the instance url for the user when his token is generated. I store this instance url and use that for all their API calls.

Any help regarding this would be appreciated.

  • Any ideas?

    I just need to know how to get the site_url in 


  • On connecting some SugarCRM instance in your project you need to customize this call from SugarCRM in order to inform the site_url so your project identify it and callback when needed. Obviously the endpoint at your project has to be customized accordingly.

    The site URL can be fetched by the code below:

    global $sugar_config;

    $site_url = $sugar_config['site_url'];

    From your project you are able to identify the remote url (_SERVER["REMOTE_ADDR"]) but unfortunately it will provide only the IP not the real requester/site_url.

    I hope it may shed some light.


    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks for the reply.

    My problem starts at the very beginning. The token url itself needs a site url. How am I supposed to authorize a user when he enters his username and password if the url used for authorization needs the site url?  Am I supposed to get this from the user?

    And I'm using the web api with Java in my website.

  • You really must ask the customer for his site URL.

    SugarCRM has multiple installations, one per customer - which can be on premise at customers IT, it is not like SF where you have one common entry point.

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    SugarCRM Deutschland GmbH