API Create one-to-many items

I want to create a record and it’s references in one API call.

For example:

Say I have a ‘Projects’ table and a ‘Tasks’ table. I want to create a project and its tasks in one API call like:

{
“Project Name”: “Fix bug”,
“Due Date”: 2022-02-20,


“Tasks”: [
“Task Name”: “Reproduce bug”,


]
}

I am not sure if this is possible?

At the moment the only way I can think of doing it, is by first creating the Project and then after the Project is created, I can create tasks and allocate them to a project using the project ID.

Hello @Bernard_Oosthuizen!

There isn’t a way to do this in a single call in the current API. So what you are thinking of is correct: add a Project in one call, and add Tasks for it in another.

Is convenience the main motivation for doing it in a single call? If for some reason it’s awkward to get the ID from the newly-added project, you can use the project name for the reference-to-Project column when adding the tasks. For this to work, the “project” reference column in the Tasks table should be set to show the project name, and project names should be unique.

1 Like