Skip to main content

Update an Object Definition

Jetmir Abdija avatar
Written by Jetmir Abdija
Updated over a month ago

This endpoint serves to replace an existing object definition. You can update different attributes of an object definition by setting the desired values and passing them to the endpoint PUT /object-definitions/{id}.

Specify the following in your request:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition that you want to have updated/replaced.

  • The header for your API request

  • The request body

NOTE: The request body includes values for all parameters that you intend to add and retain for a given definition. Omitting any data in a PUT call will result in its deletion.

HTTP responses

HTTP response status code

Interpretation

202 Accepted

Added to the queue to be processed

400 Bad Request

Performs the validation on the PUT body. Returns which properties were invalid, if the object definition ID is not found in the database or another update is being applied.

Error messages:

  • There might be an ongoing update in progress. Please try again later.

  • The requested object definition with ID 'id' could not be found in the database

401 Unauthorized

Invalid or missing API key secret and/or tenant

403 Forbidden

The user is not allowed to update this object definition

Due to the long-running process behind this endpoint, passing a valid request always returns a 202 Accepted HTTP status code and the response body. A 202 Accepted means that the request was sent to a queue and will be processed at a later time.

Conditions

  • is_mandatory has to be true if you need to update the value of a locked property

  • If the request contains an object definition id that is present in the database and of the valid format, a 202 OK is returned

  • If the request contains an id of an incorrect format, a 400 Bad Request is returned

  • Mandatory/locked properties cannot be removed

  • Properties cannot be renamed

The linked questions (on both properties and questionnaires) and source connections are not supported. If these are configured on an object definition, the configuration will be removed after an update with the public API.

A potential workaround would be to leave all locked properties out of an update. This way, the linked question for the locked property will not be affected. However, the linked questions on questionnaires and non-locked properties, as well as the source connections, will still be affected.

Parameter

Type

Mutable

Description

id

string

X

Unique identifier for the object definition. It is mandatory, must already exist and match the ID in the URL.

name

string

The name of the object definition. It must be unique in the tenant, not be empty and contain between one and 255 characters.

object_properties

array

A list of object properties. If not added or empty, all non-locked properties will be removed.

object_properties[].name

string

The name of the object property. It must be unique for the object definition, not be empty and contain between one and 255 characters.

object_properties[].value

string

The standard value of the object property. Must contain between one and 255 characters.

object_properties[].is_mandatory

boolean

Specifies if the property is locked or not.

Default value is 'false'.

related_boem

array

A list of questionnaires. If not added or empty, the questionnaires will be removed.

related_boem[].id

string

Unique identifier for the questionnaire field

Rename an object definition

To change the name of an object definition, use the PUT /object-definitions/{id} endpoint specifying the following in your request:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition that you want to have updated/replaced.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

Here is an example API request of how to change the name of the object definition to New Application. Pass a PUT request with the body that contains the desired value for the parameter name.

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [],
    "related_boem": []
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}

Add an object questionnaire

To add an existing questionnaire to an object definition, make a PUT request to the /object-definitions/{id} endpoint specifying:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition that you want to have updated.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

The term boem that is used in the implementation refers to the concept of questionnaire, so all parameters containing boem element serve to handle questionnaires in BlueDolphin.

The example below shows a sample API request to add the existing object questionnaires Application Info and Application Questionnaire to the object definition New Application:

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [],
    "related_boem": [
        {
            "id": "58edcaf2829327621cecc9e5"
        },
        {
            "id": "6409d89638102b8f57cece3e"
        }
    ]
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}

Remove an object questionnaire

You can remove an object questionnaire by passing a call to the endpoint PUT /object-definitions/{id}. For a call to be successful, specify the following:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition from which you want to remove a questionnaire.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

Here is an example API request of how to remove the existing object questionnaire Application Questionnaire from the object definition New Application. In the previous example, two questionnaires have been added and here we will remove one of them.

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [],
    "related_boem": [
        {
            "id": "58edcaf2829327621cecc9e5"
        }
    ]
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}

Add an object property

To add a new property to an object definition, make a PUT request to the /object-definitions/{id} endpoint specifying:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition which you want to add a property to.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

The example below shows a sample API request to add a new object property of the name Supplier and the standard value Microsoft to the object definition New Application.

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [
        {
            "name": "Supplier",
            "value": "Microsoft"
        }
    ],
    "related_boem": [
        {
            "id": "58edcaf2829327621cecc9e5"
        }
    ]
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}

Update an object property

Here we describe the steps to update an existing object property. To perform this action, make a PUT request to the /object-definitions/{id} endpoint specifying:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition for which you want to update a property.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

The example below shows a sample API request to update the object property of the name Supplier and the standard value Microsoft on the object definition New Application. In this example, we will change the standard value of the property from Microsoft to AWS.

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [
        {
            "name": "Supplier",
            "value": "AWS"
        }
    ],
    "related_boem": [
       {
            "id": "58edcaf2829327621cecc9e5"
        }
    ]
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}

Remove an object property

In this section we describe the steps to delete an existing object property. To perform this action, make a PUT request to the /object-definitions/{id} endpoint specifying:

  • Resource/endpoint destination URL. Replace the path parameter {id} with the ID of the object definition from which you want to remove a property.

  • The header for your API request

  • The request body which should include all parameters that you want to keep in the replaced resource

The example below shows a sample API request to delete the object property of the name Supplier and the standard value AWS from the object definition New Application.

curl -L -X PUT 'https://public-api.eu.bluedolphin.app/v1/object-definitions/640b3d7d4a28b925fcf8b9a2' \
-H 'x-api-key: YOURAPIKEYSECRET' \
-H 'tenant: yourtenantname' \
-H 'Content-Type: application/json' \
-d '{
    "name": "New Application",
    "object_properties": [ ],
    "related_boem": [
        {
            "id": "58edcaf2829327621cecc9e5"
        }
    ]
}'

A valid request returns a response with a 202 Accepted HTTP status code and the following body:

{
    "result": "OK"
}
Did this answer your question?