Cannot add multiple links "row does not exist"

I can’t seem to add multiple links at once. I’m following the API docs here
https://api.seatable.io/reference/create-row-links

I can create links individually using this format

url: flow.get("URL") + "dtable-server/api/v1/dtables/base_uuid/links/",
payload: {
    table_name: 'Systems',
    other_table_name: 'Modules',
    link_id: 'XTEb',
    table_row_id: msg.system_row_id,
    other_table_row_id: row_id
},

But if I use this format where ‘row_ids’ is the list of ids (which all work individually), it doesn’t work.

url: flow.get("URL") + "dtable-server/api/v1/dtables/base_uuid/links/",
msg.payload = {
    other_rows_ids: row_ids,
    table_name: 'Systems',
    other_table_name: 'Modules',
    link_id: 'XTEb',
    row_id: msg.system_row_id
  }

I get “row does not exist”. But which row?

The docs show that the url for adding one link and multiple links is the same. The only difference are some of the key names in the payload, and using a list of strings for other_row_ids instead of a string for other_table_row_id.

(payload and flow etc are because I’m using node-red)

Am I missing something or are the docs wrong?

The difference between these two API calls is, that:

  • create one link is POST.
  • create multiple links is PUT.

I just checked and I could create multiple links at ounce with the following code:

curl --request PUT \
     --url https://cloud.seatable.io/dtable-server/api/v1/dtables/5013dd92-2c9a-436f-abc9-e76738400ef3/links/ \
     --header 'accept: application/json' \
     --header 'authorization: Token ...' \
     --header 'content-type: application/json' \
     --data '
{
  "other_rows_ids": [
    "C-iDPlJyTPiQW1WzAMxhOw",
    "T5vUHFMlR2anRlaEMKsvcg"
  ],
  "table_name": "Table1",
  "other_table_name": "Table2",
  "link_id": "Kpb2",
  "row_id": "ahStR8vpR96bhVMUMssfUw"
}
'

Ah thanks! Did not notice that.

Now I just a new error: “paramater_error”. Really wish it gave more feedback. By parameter I assume it means one of the key:value pairs but they’re named correctly.

Apart from specifying PUT and updating the data, would there be any other format differences between POST and PUT? Should the headers remain the same?

Please check if your other_rows_ids is really an array with row_ids?

The data for the PUT request looks like this

{
"other_rows_ids":
   [
      "T1nEg-N6QXeATB6lE5yvaA", 
      "NPf66bzBTueedj8pG8P1_w",
      "FzlTy9vJQzqqY8jvKWawew",
      "e8SQiyCmRKmBxhf-3xrsUw",
      "HhaB_ZxoRcqOJlQHkne8Wg"
   ],
   "table_name":"Systems",
   "other_table_name":"Modules",
   "link_id":"XTEb",
   "row_id":"IPpBc7Y-Rg6tac_FzJSriA"
}

I’ve confirmed the IDs are all correct

The data for the single POST request looks like this. Headers are all the same

{
   "table_name":"Systems",
   "other_table_name":"Modules",
   "link_id":"XTEb",
   "table_row_id":"U4HDGs48QAuKgkOrgPaPjg",
   "other_table_row_id":"QwKg12OTSgKykNuDpALjig"
}

This works

Just to be clear, the POST works and the PUT doesn’t

I can confirm that both API-calls are working. Therefore it is difficult for me to understand what your problem is. Please create an invite link and send me the invite link together with your two requests (the one that is working and the one that is not working) and I will have a look.

Thanks a lot for checking. Good to eliminate any issue with the API, I’m definitely doing something wrong. I’ll dig into it a bit more.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.