Reference identifiers¶
Overview¶
The Pontotel API uses different types of identifiers depending on the resource to facilitate the creation of new entities or updating them. Understanding these formats is essential for building robust integrations with an extra ease.
In general, the endpoints that have this active resource will have the attribute and also another field in the request that says which identifier we are using to identify that attribute. For example, to define an employee's employer by default, it would be necessary to inform the employer's internal id at Pontotel, but the API allows the CNPJ to be used as an identifier, and it is possible to pass the employer's CNPJ on the attribute value and inform that we will use CNPJ as an identifier for the employer: {"empregador": "84984743000133", "identificadorEmpregador": "cnpj"}
By default o id is the identifier and, in most cases, we have the codigo as available identifier as well.
Reference identifiers¶
When creating or updating entities that refer to others, it is possible to specify which identifier is being used for each reference. This avoids the need to seek the id internal before creating a record, requiring an extra operation to create or update a record. The default is: the field with the reference value accompanied by a field identificador<Entidade> indicating the type:
This payload would have the same result as the payload following:
Usually the code is widely used in these cases because it is an open field so that the API client can define it to identify entities between systems, being the codigo the link between entities in different systems.
Employee¶
When registering or updating an employee, it is possible to refer to scale, calculation rule, workplace, employer and direct leader by different identifiers:
| Field | Identification field | Accepted values |
|---|---|---|
escala | identificadorEscala | id, codigo, nome |
regraCalculo | identificadorRegraCalculo | id, codigo, nome |
localTrabalho | identificadorLocalTrabalho | id, codigo, nome |
empregador | identificadorEmpregador | id, codigo, cnpj |
usuarioLiderDireto | identificadorUsuarioLiderDireto | id, codigo, email |
Instead of passing the internal ids of the references, payload may only have the code identifying entities:
This way, as the code is used to save the link id between entities in the systems, it is easy to get it to build the employee integration payload.
Users¶
When registering or updating a user, it is possible to refer to employer and location by different identifiers:
| Field | Identification field | Accepted values |
|---|---|---|
permissao | identificadorPermissao | id, nome |
empregado | identificadorEmpregado | id, codigo |
grupos | identificadorGrupos | id, codigo |
locais | identificadorLocaisDeTrabalho | id, nome, codigo |
permissaoAppGestao | identificadorPermissaoAppGestao | id, codigo, nome |
usuarioLiderDireto | identificadorUsuarioLiderDireto | id, codigo, email |
Homogenous values in arrays
When passing arrays of grupos or locais, all values must use the same type of identifier. Cannot mix id and codigo in the same array.
Good practice¶
Use business keys for system links¶
Always use the field codigo by integrating with other systems to identify entities, so that this field is equivalent to the entity identifier in the other system, i.e. its internal id or registration, in order to facilitate integration flows — the id inside Pontotel can vary between environments (homologation, sandbox and production)
Next Steps¶
Now that you've learned about basic API concepts and features like filter and identifiers, you can:
- Contact the service requesting an API user in the approval environment
- Request complementary materials such as Postman collections and plans to facilitate field mapping between systems