Get all attachments for a project?

I just tried the “/attachments” endpoint, using the id of a project as parent parameter.

Following a recent question in that forum.

I did not get any results.
No errors, just an empty array.

What is that endpoint used for, when using the id of a project as parent?

If I set the id of a task as parent, I get the same results as requesting /task/id/attachments.

But, we are allowed to set the id of a project as a valid parent parameter.
example
GET /attachments/?parent=IdOfProject

Has anyone here used that endpoint and get results?

I tought I could get results from all attachments in a project, from tasks AND discussions, but I get nothing.

If you read the doc for this specific endpoint you’ll see that the gid can only be a task or a project brief.

1 Like

It depends on which doc you read!

Look at the error message from the /attachments endpoint, when we use a Workspace ID as parent, which is invalid.

message: “parent does not refer to a task, project, or project brief, and so it cannot have attachments.”

When I use a “project” id, I don’t get any error, just an empty array.
So, it looks like it’s ok to use a project id as parent.

@Phil_Seeman who from the API team is active here? To mention to disconnect between doc and reality?
Thanks Fred!

1 Like

@AndrewWong

Hey folks, Sasha from the Developer Relations team here. I tried GET /attachments with a workspace as a parent and then a project as a parent and got the same results as @Frederic_Malenfant. Notably, I received an empty array when parent was a project despite that project having various files and tasks with attachments. I’m going to look into this further and circle back!

2 Likes

Thank you @sasha_f , we wait for your response!

If we can query attachments from that endpoint directly, that is something we’ll certainly use in our application, because the “download all documents” is one of the favorite feature our customers really like!

Hey folks, I have an update. So there are three possible parent’s for GET /attachments:

  1. projects
  2. project briefs
  3. tasks

For project, this refers to files uploaded to Overview (tab) -> Key Resources
For project brief, this refers to attachments (usually images) inlined in the project brief.
For tasks, this refers to the common attachments (I think this one most are familiar with).

I think the documentation for this is out of date and I’ll work on getting it updated.

Hope that helps and let me know if you have any more questions!

2 Likes

Thank you very much for taking time to help us understand what’s happening with that endpoint!

Very appreciated.