API issues: Adding subitems

I’m having trouble when adding multiple items with multiple sub-items. For a sense of scale, I have a script that’s attempting to add circa 125 subitems across circa 75 items. There’s two issues:

  1. Subitems do not always add
  2. API calls to add subitems sometimes indicate they failed, but actually didn’t

Does anyone know why this occurs? Is it being fixed in the API? Are there any workarounds?

Details:
Subitems do not always add
Using a query like:

mutation {
  create_subitem ( parent_item_id: 1234,  item_name: "Some Item Name", column_values: "{\"properly\": \"escaped json here\"}"
    ) 
  { id }
}

Sometimes gets a result like :

{ "data": { "create_subitem": null }, "account_id": 9999}

Which indicates that it was not possible to create the subitem i.e. the id of the subitem is null.

This contrasts with a nice response like:

{ "data": { "create_subitem": {"id": "1234"} }, "account_id": 9999}

P.S. I know the parent item exists as other subitems of the parent did get added successfuly.

API calls to add subitems sometimes indicate they failed, but actually didn’t

Me: Ahaa! I shall retry the attempts when they fail
Monday.com API: Not so fast, sometimes I will lie to you so you can’t do that! evil laugh

Testing for the create_subitem request giving a null response and trying again has lead to its own issue. This is the behaviour we have seen:

  1. Request to create subitem
  2. Response from API with "create_subitem": null
  3. Retry request to create subitem
  4. Response from API with "create_subitem": {"id": "1234"}
    HOWEVER: two tickets have been created, one with the ID 1234, but another from the first API request as well.

The only thing we can think of doing, is querying for the parent and checking how many subitems there are and whether it was how many we were asking to create. If it wasn’t then delete all the subitems and try to create. This is pretty horrible :frowning:

Help! :slight_smile:

1 Like

Hey @SirOnion :wave:

Thanks so much for getting in touch with us about this issue and allowing us to help! I am really sorry for the inconvenience - this does sound like a worrying behaviour. I’d love to investigate this further and see if this is something we could fix moving forward.

It would be really great if you could provide us with a bit more info on the board, as well as timestamps and examples of the results you are getting. To make sure we can keep the sensitive info private, I’ve reached out via PM on the forums to connect further :slight_smile:

-Alex

For all future readers: this issue has moved to a private ticket and escalated in a bug report for our developers to investigate further.

If you run into a similar issue, feel free to start a new thread or email into appsupport@monday.com. Thank you!