How to generate the API Token
The API Token for the REST Integration API is on the user record in Demander Web. Only a user with the Usuário Api Rest group can be used in this integration.
Where to see the ApiToken
Section titled “Where to see the ApiToken”Open Usuários and open the record.
The ApiToken field appears when the Usuário Api Rest group is selected in Grupos de usuários. Without that group, the field stays hidden.
The value is not typed. Use Gerar to create a new token. The lock shows or hides the value. The icon next to the title copies the token.
How to register
Section titled “How to register”- In Usuários, create a user or open an existing one.
- In Tipo, choose Empresa.
- If the Empresa field appears, fill it in. Someone who is already a user of type Empresa does not see this field: the user stays on the company of the person registering.
- In Grupos de usuários, select Usuário Api Rest.
- Click Gerar in the ApiToken field.
- Save.
It is not possible to add other user groups when the Usuário Api Rest group is added.
When a new token is generated and saved, the previous token stops working. The integration that still uses the old token stops authenticating until it receives the new one.
User limitations
Section titled “User limitations”The Usuário Api Rest group only applies to the Empresa type. Someone who is already a user of type Empresa does not see the Empresa field: the user stays on the company of the person registering. In other registrations, the company must be filled in. Outside the Empresa type, the record does not save.
With the group selected, ApiToken is required. Without a token, the record does not save.
This user does not log in to Demander Web, the App Demander, or the App Separação. The message is: “Este usuário é exclusivo da Api Rest e não acessa o Demander Web nem o aplicativo.”
The user must be active. An inactive user does not authenticate on the API.
Use in the REST API
Section titled “Use in the REST API”In the call, send the user’s company and their ApiToken:
idEmpresa— company code of the userx-api-token— ApiToken, in the request header
Example in the REST API overview.
Frequently asked questions
Section titled “Frequently asked questions”Does this token work for the Synchronizer?
Section titled “Does this token work for the Synchronizer?”No. This token is only for the REST API. The Synchronizer and the integration web services use the Company Token.
The Company Token is in the Company record, on the company’s gear icon, Integration tab. Generate the token and save before using it. The details are in Registering a company in Demander Web and in Demander API - Receive data from Demander.
If the Synchronizer receives the API Token, or the partner token, the response is ERRO 01: Nenhuma empresa localizada com o Token.
Does the API Token work for several companies?
Section titled “Does the API Token work for several companies?”No. The token belongs to the user, and the user in the Usuário Api Rest group is linked to a single company. A partner does not use the same token for other companies.