Support Topics Documentation Slack YouTube Blog

Using POSTMAN to POST object with relation to another table using REST API

I’m trying to add a new object to a table where some columns (instructors and class names) have a relation with other tables.

I’m facing some issues with adding a new object that sets the relation (eg. I want to add a schedule item that sets instructor A as the “instructor”, and class name A as the “class name”).

Here’s my JSON body:

{
    "classStart": 1601298000000,
    "zoomPW": "340073",
    "classEnd": 1601301600000,
    "created": 1599137953000,
    "active": true,
    "capacity": 20,
    "zoomID": "865 7719 5468",
    "classDuration": 60,
    "zoomLink": "https://us02web.zoom.us/j/86577195468?pwd=R0Y1QW1RMitET2xieUJLb3FSV3c1dz09",
    "className":
  [
    {
      "___class":"classTypes",
      "name":"Ashtanga Basics (Livestream)"
    }
  ],
  "instructor":
  [
    {
      "___class":"instructors",
      "name":"James"
    }
  ]
}

Based on Backendless’s documentation and tutorials, it seems like the code above is correct, but somehow, the object created has its instructor and class name fields empty.

So I managed to create an object in the table, but the relation fields return empty.

I’ve followed the tutorial here https://backendless.com/how-to-add-objects-with-relations-using-rest-console/ but doesn’t seem to work for me.

Am I missing something?

Thank you so much in advance :slight_smile:

Hello @Peculiar_Yogi

We apologize for any misunderstanding. The feature described in the article above will appear in the next releases. For now, you can only use the ADD / SET Relation methods:

https://backendless.com/docs/rest/data_explicit_relation_list.html

Regards,
Inna

Hey @Inna_Shkolnaya, so just to clarify: we have to create the object first in the first API call, and in a separate API call, to add/set the relations, yes?

@Peculiar_Yogi

Yes, you are absolutely right.

Regards

Alright, thanks for clarifying!