Allow relationships to be set via API | Community
Skip to main content

Allow relationships to be set via API

  • July 18, 2023
  • 3 replies
  • 0 views

Create and Update of Custom Objects throws a 503 error when I include ticket or user relationships in the API payload.

{
    "custom_object_record": {
        "name": "Test Record",
        "custom_object_fields": {
            "ticket_to_alarm_relationship": 1996,
            "user_to_alarm_relationship": 1517839046222,
            "wake_date": 1689717600
        }
    }
}

results in a 503 error

{
    "error": {
        "title": "DatabaseError",
        "message": "Unknown database error"
    }
}

note: Everything works if the 2 relationship custom object fields (ticket_to_alarm_relationship, user_to_alarm_relationship) are removed from the request payload. 

These same 2 custom object fields are returned as datapoints when doing a GET on an existing object, so it seems like they would be available.  However, I don't see relationships documented in the Developer API Reference.  Am I missing a reference to the right way to accomplish this somewhere?  Or is it not available yet?

 

3 replies

Ashwin11
  • July 18, 2023

Hi @james50 - I presume that ticket_to_alarm_relationship and user_to_alarm_relationship are Lookup fields you have created within the Object that point to Tickets and Users respectively. Can you add quotes for the value? We accept only strings for lookup field values

{
    "custom_object_record": {
        "name": "Test Record",
        "custom_object_fields": {
          "ticket_to_alarm_relationship": "1996",
          "user_to_alarm_relationship": "1517839046222",
            "wake_date": 1689717600
        }
    }
}

Ashwin11
  • July 18, 2023

  • Author
  • July 18, 2023

Quoting the values for the two relationship keys fixed the issue, thank you Ashwin.  

I was thinking they were numeric but should have noticed that they were quoted in the GET response.  Thanks again!