Skip to main content

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​

  1. Unique Identification: Each company has a unique identifier id that distinguishes them from other companies in the system.

  2. Company Data: We store certain company data in our database (name, email, telephone number, website...).

  3. Activities and Logging: Activities performed by a company within the system, such as creation, modification, or deletion of resources, may be logged.

  • 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​
NameDescriptionTypeDefault Value
id ID of the companyString optionalid
pagePage numberInteger1
pageSizeNumber of items per pageInteger10
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​
NameDescriptionType
idRemoteIdentifier of the new CompanyString
stateIdState identifierString
companyNameName of the new CompanyString
commercialNameCommercial name of the new CompanyString
tinIdentification number of the new CompanyString
addressAddress of the new CompanyString
cityCity of the new CompanyString
defaultDetermines if the new Company is the default CompanyBoolean

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​
NameDescriptionType
idCompany identifierString 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​
NameDescriptionType
idCompany identifierString required

πŸ‘‰Try it out🌱

Possible Response Errors​

ErrorResponse StatusResponse 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"}