REST API: Create Object with References Example

Chad Peters October 13, 2017

Would it be possible to provide here or via the REST API documentation 

https://documentation.riada.se/display/ICV50/Objects+-+REST

an example of creating an object which includes a referencedObject attribute? 

I'm not overly sure what's required and haven't had luck with my tests. 

1 answer

1 accepted

0 votes
Answer accepted
Alexander Sundström
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 16, 2017

Hi Chad,

This is an example where I set an object referenced:

{
  "objectTypeId": 10834,
  "attributes": [
    {
      "objectTypeAttributeId": 90041,
      "objectAttributeValues": [
        {
          "value": "Test object"
        }
      ]
    },
    {
      "objectTypeAttributeId": 94875,
      "objectAttributeValues": [
        {
          "value": "IN-247"
        }
      ]
    }
  ]
}

What you have to set as the value is the KEY for the object.

Best Regards
Alexander

Chad Peters October 16, 2017

Thanks! Worked like a charm. 

Alexander Sundström
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 17, 2017

Great :)

Jeret Shuck February 11, 2022

Thanks for the example! I'm doing something similar. However, what if you need to add multiple references in the same attribute?

For example, I have the Insight attribute called "Entity" that can have more than one reference object in there. Effectively, I'm trying to do something like:

 

{

    "objectTypeAttributeId": 68,

    "objectAttributeValues": [

        {

            "value": "SC-363||SC-300||SC-301"

        }

    ]

}

 

EDIT: I got it working

{

    "objectTypeAttributeId": 68,

    "objectAttributeValues": [

        {

            "value": "SC-363"

        },

        {

            "value": "SC-300"

        }

    ]

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events