Manuais
PHC GO Generate Access Token
 
Information
Before using this method, you need to request an APP ID and integrate it into your PHC GO installation. For more information about APP ID Request, click here.

 

Method


The method to be called is:



Parameters


In the request headers the Authorization header must have the Access Token:

  • Authorization: {{accessToken}}


JSON body


In the body of the POST a JSON structure like this one has to be passed:

{
"credentials":
{
"backendUrl": "xxx",
"appId": "xxx",
"userCode": "xxx",
"password": "xx",
"company": "xxx",
"tokenLifeTime": "xxxx"
}
}

 

Return Information


Any call made to this method will return a JSON information with this structure:

  1. In case of success:


    {
    "code": 0,
    "message": "Token generated.",
    "token": "AUTHENTICATION TOKEN"
    }


  2. In case of error:


    {
    "code": 100,
    "message": "Error message"
    }


Notes

When calling the API methods, by means of a valid token, if not using it for more than 30 min, the software makes an automatic logout in order not to block the user in an infinite circuit. Therefore, when resuming the use of the API, the first call will have a delay of approximately 5-10 seconds longer than the normal operational flow in order to restore the connection.

Credentials


NameTypePHC GO EntityPHC GO FieldObservations
backendUrl1String––URL of the PHC Go installation
appId1String––Id provided by PHC
userCode1String––User of the App
password1String––Password of the app
companyString––The name of the companies Database.

This field only needs to be added if the user has more than one Database and wants to specify it, otherwise it will go to the default one
tokenLifeTimeString––Time in minutes before the Access Token expires and a new one is required.

Default value of 30 minutes.

It is possible to create a Token that does not expire and is always accepted by this API by sending this value as “Never”.

 


Footnotes


1 - Required