Hey !
I wanted to point out an issue in the Assets upload api documentation that I’ve encountered while building an integration.
Specifically in this section
In the graphQL and curl example, it is mentioned to use “files” for the column_id
However using this column_id will result in a 500 error
{"status_code":500,"error_message":"Internal server error","error_code":"INTERNAL_SERVER_ERROR"}%
Despite that error code, the file is still being uploaded to the file, however on top of throwing an error in my code, it prevents me from getting the id of the asset that was uploaded.
In order to circumvent this issue, I inspected the network calls of the webapp and realized that it was using the “files__1” for the column_id.
This solution was successfull:
It also doesn’t change the fact that an upload using the “files” column_id, why I assume corresponds to the file gallery of an item is successfull while returning a 500 error !
The column ID is a unique identifier for a specific column on a specific board.
Before updating any column (files or otherwise), you need to first look up the ID of the column you’re trying to update, and then tell the API the ID of that column.
Thank you @dipro , this is very clear ! I feel like this could defenitly be a nice addition to your documentation.
I’m wondering is there any way to satisfy my initial intention, which is to upload a file to the gallery via the api ?
Similar to what happens when clicking on the Add file button on that screen:
When i make the following call with the “wrong” column_id, I can see the file being uploaded in the gallery but the response doesn’t allow me to retrieve the asset id :
This suggests that the upload and attachment to the column is actually a 2 step process.
Step 1: upload the file — this is successful, so the file is attached to the item in the gallery.
Step 2: link the file in the gallery to the column — you’ve provided an invalid column id, so this part throws an error.
Perhaps this should happen in a single transaction and roll back if either step fails. Or perhaps it’s good that mdc holds onto the file in the first step.
Using the api, is it possible to upload a file directly to the gallery without relying on a column ?
When following the documentation and using the “files” column_id, it will upload the file to the gallery but return an error. What is wrong here ? The file being uploaded despite the error ? Or the fact that an error is returned ? Both are very confusing for an api consumer’s perspective.