Complexity on Assets

I’ve been using these API Queries for quite some time, and today I’m running into errors.

Here is the query:

query { boards (ids:xxxxxxx) {items { id assets { id name }}}}

The error I’m getting back:

{‘errors’: [{‘message’: ‘Query has complexity of 2011020, which exceeds max complexity of 1000000’}]

This board has less than 100 assets, so why would this happen suddenly?

Hey @jbrooksga :wave:

Welcome to the community - I’m glad you’re with us now :slight_smile: So sorry you’re having issues with this query now, but I appreciate the opportunity to help.

We are currently investigating this issue with our developers and as soon as I’ll have more news to share on this, I’ll get back to you with an update. In the meantime, I would mainly recommend limiting the query to specific items. You could query the item IDs within a board, and then simply query the assets of those items directly, for example:

This will have a much lower complexity cost per API call. Otherwise, you could also use the Boards query and instead, add a limit to the Items you are querying, which will also reduce complexity:

What do you think?

-Alex

Alex,

Thanks for the response.

If there was a viable method of simplifying the query I would, however in this situation I must examine every item on the board. Since I’m trying to find a specific file asset by name, there is no way of knowing which item it may be associated with.

I did find what may be an odd workaround by doing this:

query { boards (ids:852918582) {items (limit:400) { id assets { id name }}}}

Why that works I’m not sure. The odd thing is that board has less than 50 items, yet without the limit the query is deemed too complex. It seems as if the default query without any limits has an issue.

1 Like

@jbrooksga

Thanks for circling back with me here! If you are looking for an asset by name, and it is stored within the File column, perhaps it might make sense to use items_by_column_values instead, and use the full item name in the query? If you know the file name and the extension, the query will be able to return the Item ID that holds it.

As for the limit - at the time, even though we paginate starting at 25 items, an items query without a limit will try and pull the data for 1000 items instead. This is why introducing a lower limit can make this query work. I hope this helps clairfy.

-Alex

Alex,

I wasn’t aware that items_by_column_values would work for this.

I’ll give this a try.

@jbrooksga

Please let me know how this works out for you :slight_smile:

As for the reason you’ve had this issue in the first place, we’ve now introduced a complexity limit per query. It was initially set to 1,000,000 complexity, as the complexity limit for Trial accounts, but after some consideration, we’ve raised the limit per query to 5,000,000 (5M) complexity.

We are going to post an announcement with more details soon. :slight_smile: I hope this helped clarify.

-Alex

So far the items_by_column_values query is working out well.

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