Upsert of objects

Either create new objects if they do not yet exist or update existing objects in one call

The upsert endpoint has the same specification as the insert endpoint.
An upsert endpoint typically performs a create on new objects and updates existing objects in the payload.

The advantages of using this endpoint is that the client has a more convenient way to create or update his data.
However, a client looses the control, especially if there is a certain logic for existing objects.

The import API has the following mandatory headers:

  • x-api-key for authentication and authorisation

The following headers are optional - but we recommend to use them if they are available:

  • X-DATASOURCE' : the UUID of the data publisher
  • X-PUBLISHER: the UUID of the publisher the data should be inserted

To import your data send a HTTP PUT request to the API ts/v1/kg/things/imports

Upsert our running example

curl --location --request PUT 'https://proxy.opendatagermany.io/api/ts/v1/kg/things/imports' \
--header 'Content-Type: application/ld+json' \
--header 'x-api-key: $API_KEY' \
--data-raw '{
  "@type": "https://schema.org/Event",
  "https://schema.org/description":"This is the running example event description",
  "https://schema.org/name":"Running example",
  "https://schema.org/startDate": "2023-05-16T18:00:00+02:00",
  "https://schema.org/url": "http://example.com/exampleEvent",
  "https://vocab.sti2.at/ds/compliesWith": {
    "@id": "https://semantify.it/ds/mhpmBCJJt"
  }
}'

A payload without any @id information would be equivalent to a simple insert.

If there are @id information, then the system checks if such graph nodes already exists in the KG and perform an update if necessary.
!Note We do not allow for cross-graph data manipulations. That means, that all existing @id s must have been inserted into the same graph.

A successful started upsert should return the response code 202 ACCEPTED with the following response:

{
    "message": "IMPORT_PROCESS_ID"
}

What’s Next