Work with Attachments using APIs | Targetprocess - Visual management software

Work with Attachments using APIs

In Targetprocess, attached files and uploads are stored in the form of Attachment resources. In order to automate attachments management, you can use CRUD (create / read / update / delete) methods supported by our APIs.

Get Attachments

Get list of all Attachments

REST API allows to get the list of all Attachment files that currently exist in the system. Every list element contains the URI’s to the Attachment resources (Uri property) and references to a general entities (for example, User Story, Bug, Task, Feature, Release, etc.) in General property.

The endpoint for a REST service will be:

https://your-targetprocess-application-URL/api/v1/Attachments/

You get the list of nodes. Each node represents the single file in the system. Format is the following:

<Attachment Id="1234" Name="NewAccountScreen.xls">
<Description>Form for new Account creation.</Description>
<Date>2008-03-13T13:01:08</Date>
<MimeType>application/vnd.ms-excel</MimeType>
<Uri>
https://your-targetprocess-application-URL/Attachment.aspx?AttachmentID=1234
</Uri>
<ThumbnailUri>
https://your-targetprocess-application-URL/AttachmentThumbnail.aspx?AttachmentID=1234&width=100&height=100
</ThumbnailUri>
<Size>47616</Size>
<Owner ResourceType="GeneralUser" Id="23">
<FirstName>James</FirstName>
<LastName>White</LastName>
</Owner>
<General ResourceType="General" Id="1884" Name="Create Account Service"/>
<Message nil="true"/>
</Attachment>

See the definition of available fields at https://md5.tpondemand.com/api/v1/Attachments/meta.

If you work with an account hosted on our cloud servers, please always use https:// prefixes when you request a list of attachments. Otherwise you will get wrong URI's to the elements.

Sometimes you may face the large results set issue when not all Attachments are seen to be included in the response. You have to iterate over each General item and then make a second call that pulls the attachments URLs for that specific General item id. Use REST API pagination carefully as well.

Get list of all Attachments for an entity with known ID

https://your-targetprocess-application-URL/api/v1/Generals/1884?include=[Attachments]

You can use relevant Entity type here. Use our Resources model for the reference. Most common endpoints are:

  • UserStories
  • Tasks
  • Bugs
  • Features
  • Epics
  • Iterations
  • Releases
  • TeamIterations
  • Requests

Filtering and sorting Attachments list

These actions are not supported so far. You have to query for the list of all Attachments, parse, filter and sort them on client side and then look for required elements.

Download single Attachment file

https://your-targetprocess-application-URL/Attachment.aspx?AttachmentID=1234

For authentication, you can use basic authentication method or send a cookie that imitates web browser behavior.

HTTP GET request type should be used.

Basic authentication

It is possible to generate basic authentication credentials that are not related to a specific Targetprocess user. Special account 'System' can be used for this purpose. It does not belong to any specific human user and we recommend to use this account for integrations.

Password for the System user should be set in advance by Targetprocess Administrator on Settings → General Settings Settings → System User Credentials panel.

Then, you encode the pair system:passwordofsystemuser as base64 encoded string and pass this parameter in the header of your request to the API.

Download single Attachment file

Cookie authentication

It is required to set properly Accept and Cookie header fields of the HTTP GET request.

Token authentication

You can't use REST API Token to download attached file so far.

Create Attachments

Instruction and example was moved to Dev Guide

Download inline images

It was possible to paste images to file storage without converting them to Attachments. That happened when you pasted images from Description editor. In on-site solutions such storage method is still actual.

It's not possible download inline images via REST API. The links to such images are available for view and downloaded only to web browser client.

For our hosted solution we have switched the file storage process from inline files to the Attachment entities.

Still have a question?

We're here to help! Just contact our friendly support team

Find out more about our APIs, Plugins, Mashups and custom extensions. Join our community of passionate users and even discuss directly with our developers.