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:
- Subitems do not always add
- 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:
- Request to create subitem
- Response from API with
"create_subitem": null
- Retry request to create subitem
- 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 😦
Help! 🙂