Skip to content

Synchronise the company address from the ERP

Prerequisites

API

If you want to synchronise your company addresses from the ERP with your HIPE instance, you will be able to do it by following this process.

  1. We search if the company address already exists in HIPE, if not we create it.
  2. We update the company address if it exists based on the retrieved information.

Search the company address

To search if the company address already exists in HIPE, you will need to make a GET request to the /api/companies/{ companyId }/addresses endpoint. API reference

Terminal window
curl --location 'https://{ YOUR INSTANCE }-hipe.packitoo.com/api/companies/{ companyId }/addresses'
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }'

The response should be a 200 with zero or one company address with the same external-id. If you don’t find any company address, you can create it.

Create the company address

To create a company address, you will need to make a POST request to the /api/companies/{ companyId }/addresses endpoint.

Body parameters:

  • name: The name of the address
  • companyId: The id of the company required
  • address: The address required
  • firstComplementaryAddress: The first complementary address
  • secondComplementaryAddress: The second complementary address
  • city: The city required
  • country: The country required
  • state: The state
  • zipCode: The zip code required

You can found the other parameters in the API reference.

Terminal window
curl --location 'https://{ YOUR INSTANCE }-hipe.packitoo.com/api/companies/{ companyId }/addresses' \
--header 'Content-Type: application/json' \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }' \
--data '[
{
"companyId": "{ companyId }",
"city": "",
"country": "",
"address": "",
"firstComplementaryAddress": "",
"name": "",
"secondComplementaryAddress": "",
"state": "",
"zipCode": ""
}
]'

You should get a 201 code with the created company address in the response. You can use the id of the company address to update it now.

Update the company address

To update the company address, you will need to make a PATCH request to the /api/companies/{ companyId }/addresses/{ companyAddressId } endpoint. You can refer to the API reference for the parameters.

Terminal window
curl --request PATCH --location "https://{ YOUR INSTANCE }-hipe.packitoo.com/api/companies/{ companyId }/addresses/{ companyAddressId }" \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }' \
--header 'Content-Type: application/json' \
--data '{
"name": "HQ",
"companyId": "{ companyId }",
"address": "123 Main St",
"firstComplementaryAddress": "123 Main St",
"secondComplementaryAddress": "123 Main St",
"city": "123 Main St",
"country": "123 Main St",
"state": "123 Main St",
"zipCode": "123 Main St"
}'

You should get a 200 code with the updated company address in the response.