Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleExample

Consider the following:

Code Block
languagejson
{
  "companies": [
    {
      "referenceId": "a",
      "name": "Acme Inc",
      "registrationNumber": "acme-inc"
    },
    {
      "referenceId": "b",
      "name": "Wayne Corp",
      "registrationNumber": "wayne-corp",
      "parentCompanies": [
        {
          "referenceId": "a", <----- This doesn't have to be the same for all requests
          "ownership": 25
        }
      ]
    }
  ]
}

The referenceId for company Acme Inc is a for this particular request. It is used by company Wayne Corp to find the parent company. Avallone only uses it to do a lookup at the time of data import but uses registrationNumber and name to uniquely identify companies. This means that the referenceId can change across requests.

...

If you want to make sure that Avallone uses the identifiers coming from your side, you can configure the sync process by explicitly specifying the company id fields:

Code Block
languagejson
PUT :url/api/v1/sync
Authorization: Bearer :token
Content-Type: application/json
{
  "config": {
    "companyIdFields": ["referenceId"],
  },
  "companies": [
    {
      "referenceId": "95f03f73-c9b7-11ed-8045-5615dd1da186",
      "name": "Acme Inc",
      "registrationNumber": "acme-inc"
    }
  ]
}

...