Why does the API require the row id to add a row?

Options
Joaquinwood
Joaquinwood ✭✭✭
edited 02/27/24 in API & Developers

Hi.

I want to add a row with the API. I therefore use the Add row method.

This method requires to use the row object.

The first attribute of the object is the row's id. What sense does it make to request the row id to add a row?

If I attempt to add a row without a row id, I get the following error message:

...

"errorCode": 1012,

"message": "Required object attribute(s) are missing from your request: row.id."

...

How are we meant to obtain the row id of a row that does not exist yet? I am confused. This method seems to update existing rows, rather than add new rows. Can anyone please clarify how this method is meant to be used?

Answers

  • Joaquinwood
    Joaquinwood ✭✭✭
    edited 02/27/24
    Options
  • Lee Joramo
    Lee Joramo ✭✭✭✭✭✭
    Options

    You don't provide the Row ID. If you look at the Add Rows documentation section for Request Body schema you will see which parts of the Row Object are required or optional. The Row ID is not included

    Now if you want to specify where the Row is added, you can tell it to be Row ID of a sibling or child. (Or simply to be placed above or below all of the existing rows.)

  • Joaquinwood
    Joaquinwood ✭✭✭
    Options

    Thanks so much for your comment. In effect, the documentation of the Add row method does not mention that the row id is required in the request body schema, that is why I was puzzled when I received an error requiring me to provide a row id. However, thanks to your comment I finally was able to figure out what the issue was, so in case anyone else runs into the same problem, please check that you are doing a POST and not a PUT, otherwise you will be updating a row instead of adding a new one.