Update an N-N Association

Link two instances through an existing n-n association by sending a POST request to the events endpoint.

2 min read

Update an existing n-n association by linking two instances.

The association definition must already exist. The IDs must be provided in the same order as the association roles.

For example, for an association defined from Use Case to Country:

  1. Fixed association marker ID
  1. Association definition ID for Use Case → Country (contact Support to obtain it; this is not the field ID).
  1. Use Case instance ID
  1. Country instance ID

Send the request

HTTP URL

Set the request URL to https://<your-instance>.yooi.io/api/store/events?wait=true.

HTTP method

Set the method to POST.

Parameters (body)

Set the request body to the following JSON document.

Use this request body.

[
  {
    "id": [
      "605d3e73-85b7-5f92-a45a-490eb7920383",
      "{associationDefinitionId}",
      "{sourceInstanceId}",
      "{targetInstanceId}"
    ],
    "properties": {}
  }
]

Use the following values in the id array.

ValueDescription
605d3e73-85b7-5f92-a45a-490eb7920383Fixed ID identifying an n-n association update event.
associationDefinitionIdID of the existing n-n association definition.
sourceInstanceIdID of the instance corresponding to the first association role.
targetInstanceIdID of the instance corresponding to the second association role.
The order is important. For a Use Case → Country association, the Use Case instance ID must be placed before the Country instance ID.

Header

Add the following headers.

Use these headers in the request.

Content-Type: application/json
Authorization: Bearer #yourtoken#

Send an example request

Use this cURL command to send the event.

curl -X POST \
  'https://<your-instance>.yooi.io/api/store/events?wait=true' \
  -H 'Authorization: Bearer #yourtoken#' \
  -H 'Content-Type: application/json' \
  -d '[
    {
      "id": [
        "605d3e73-85b7-5f92-a45a-490eb7920383",
        "1a795bb9-7bb1-4592-a06e-48ae1e486b65",
        "143b0d38-710b-419b-bbba-b86f123e64c2",
        "5a57d323-3007-446a-aa78-1e073f2c7ad2"
      ],
      "properties": {}
    }
  ]'

Review the response

Review the JSON response returned by the API.

{
  "eventId": "1784819031926-0",
  "status": "validated"
}

Read more

Related articles

Was this page helpful?