Company Endpoints
The Company entity is an essential component in the management of our API. It has been designed to identify and record key information about companies. This record allows to assign invoices, delivery notes, orders and customers efficiently and accurately.
Common Company Characteristicsβ
-
Unique Identification: Each company has a unique identifier
idthat distinguishes them from other companies in the system. -
Company Data: We store certain company data in our database (name, email, telephone number, website...).
-
Activities and Logging: Activities performed by a company within the system, such as creation, modification, or deletion of resources, may be logged.
Company-Related Functionalitiesβ
-
Billing: Companies can have associated invoices.
-
Orders: Companies can have associated orders.
-
Customer and Representative Registration There may be business partners associated with an existing company.
Endpointsβ
GET/Company/getCompanyβ
Get all companies in database.
Descriptionβ
This endpoint retrieves a paginated list of the company or companies that are included in the database. The response includes information about the company and pagination. It is possible to edit the pagination options in the request parameters.
Parametersβ
| Name | Description | Type | Default Value |
|---|---|---|---|
id | ID of the company | String optional | id |
page | Page number | Integer | 1 |
pageSize | Number of items per page | Integer | 10 |
Responsesβ
JSONβ
{
"data": [
{
"id": "string",
"idRemote": "string",
"state": {
"id": "string",
"description": "string"
},
"companyName": "string",
"commercialName": "string",
"tin": "string",
"phone": "string",
"address": "string",
"city": "string",
"postalCode": "string",
"email": "string",
"website": "string",
"urlLopd": "string",
"lopdText": "string",
"invoiceFooter": "string",
"default": true
}
],
"pagination": {
"totalItems": 0,
"itemsPerPage": 0,
"currentPage": 0,
"totalPages": 0,
"nextPageUrl": "string"
}
}
XMLβ
<?xml version="1.0" encoding="UTF-8"?>
<export>
<data>
<item id="string">
<idRemote>string</idRemote>
<state>
<id>string</id>
<description>string</description>
</state>
<companyName>string</companyName>
<commercialName>string</commercialName>
<tin>string</tin>
<phone>string</phone>
<address>string</address>
<city>string</city>
<postalCode>string</postalCode>
<email>string</email>
<website>string</website>
<urlLopd>string</urlLopd>
<lopdText>string</lopdText>
<invoiceFooter>string</invoiceFooter>
<default>true</default>
</item>
</data>
<pagination>
<totalItems>0</totalItems>
<itemsPerPage>0</itemsPerPage>
<currentPage>0</currentPage>
<totalPages>0</totalPages>
<nextPageUrl>string</nextPageUrl>
</pagination>
</export>
πTry it outπ±
POST/Company/createβ
Creating a new company: Using the POST Methodβ
To create a company you must attach the request body in JSON format. Make sure to follow the schema provided in this documentation in order to perform the operation successfully. The idRemote field provided will be the one stored in the user's ERP environment. The system will automatically create a local id.
Required Parametersβ
| Name | Description | Type |
|---|---|---|
idRemote | Identifier of the new Company | String |
stateId | State identifier | String |
companyName | Name of the new Company | String |
commercialName | Commercial name of the new Company | String |
tin | Identification number of the new Company | String |
address | Address of the new Company | String |
city | City of the new Company | String |
default | Determines if the new Company is the default Company | Boolean |
The body of the request must follow the following scheme for the endpoint to perform the creation operation successfully:
[
{
"idRemote": "string",
"stateId": "string",
"companyName": "string",
"commercialName": "string",
"tin": "string",
"phone": "string",
"postalCode": "string",
"address": "string",
"city": "string",
"email": "string",
"website": "string",
"urlLopd": "string",
"lopdText": "string",
"invoiceFooter": "string",
"default": true
}
]
It is possible to add multiple Companies through the same request by separating them with commas within the array in the body of the request.
πTry it outπ±
PUT/Company/update/{id}β
Updating an existing company: Using the PUT Method.β
In order to update a company's attributes through this endpoint, it is necessary to attach the company id in the request parameters and follow the JSON schema attached in this documentation. The id parameter can be either the idRemote or the local id stored in the B2B context.
If you want to update the stateId attribute associated with the Company, make sure to add an id registered in the system.
Parametersβ
| Name | Description | Type |
|---|---|---|
id | Company identifier | String required |
It is not necessary to include the entire JSON structure, you should only include the attributes you want to modify.
Request body:β
To fully update a Company, the request body must follow the following scheme:
{
"stateId": "string",
"companyName": "string",
"commercialName": "string",
"tin": "string",
"phone": "string",
"postalCode": "string",
"address": "string",
"city": "string",
"email": "string",
"website": "string",
"urlLopd": "string",
"lopdText": "string",
"invoiceFooter": "string"
}
πTry it outπ±
DELETE/Company/delete/{id}β
Removing Company
Descriptionβ
This endpoint allows the deletion of companies using their unique identifier, which can be either the B2B system's own ID or the ID provided by you when registering companies on our platform ( remoteID? TODO ). It will not be possible to delete a company as long as it has related business partners.
Parametersβ
| Name | Description | Type |
|---|---|---|
id | Company identifier | String required |
πTry it outπ±
Possible Response Errorsβ
| Error | Response Status | Response Body |
|---|---|---|
| This error occurs when a connection to the database cannot be established. It is an internal server problem. | 500 | {"code": 500,"error": "Database connection failed."} |
| This error occurs when you cannot insert or update into the database. | 500 | {"code": 500,"error": "Invalid connection name, you cannot insert in default"} |
| This error indicates that a parameter is missing. | 400 | {"code": 400,"error": "Parameter $parameter is required"} |
| This error occurs when you are not authorized. | 401 | {"code": 401,"error": "Unauthorized."} |
| This error indicates that the company could not be found. | 404 | {"code": 404,"error": "No entity found for Company with $id."} |
| This error occurs when you try to insert a company that already exists. | 409 | {"code": 409,"error": "Duplicate entry"} |
| This error occurs when you try to send too many requests in a short period of time. | 429 | {"code": 429,"error": "Too Many Requests"} |