Create an Object

Create an object through the API with a POST request using field IDs as keys.

1 min read

Send the request

HTTP URL : https://<your-instance>.yooi.io/api/store/object

HTTP method: POST

HTTP body : a JSON document representing the object to create

Read the response

{
  "eventId": "{eventId}", // unique event identifier for the creation
  "objectId": "{createdObjectId}", // id of the created object
  "key": "{createdObjectId}"
}

Create a country

To create the country France we need to specify that it is:

  • An instance of Country
    • Instance of field ID : "a3a4f8d2-8f88-4398-99b9-37546ec9dfc1"
  • Its name is France
    • Name field ID : RIchText(France)
  • Its population is 60000000
    • Country population field ID: 60000000
  1. Send the request with the fields in the request body.
    curl -X 'POST' \
      'https://<your-instance>.yooi.io/api/store/object' \
      -H 'Authorization: Bearer {integrationToken}' \
      -H 'Content-Type: application/json' \
      -d '{
        "ee3b77dc-4172-5aae-add8-627a43b06783": "a3a4f8d2-8f88-4398-99b9-37546ec9dfc1",
        "bf040b6b-58be-5194-8f32-4e1c8df24b42": [{"type": "paragraph", "children": [{"text": "France"}]}],
        "ae94d0af-526c-458f-b522-7d5653bc492d": 60000000
      }'
  1. The result of the API call contains the event ID, the created object ID and key.
    {
      "eventId": "1632752769966-0",
      "objectId": "936793b5-ca4a-481d-8dcd-756221937e95",
      "key": "936793b5-ca4a-481d-8dcd-756221937e95"
    }
    If you can't see the instance you just created, you may have forgotten to assign rights to View concept instances. See Set Up an Integration.

Read more

Related articles

Was this page helpful?