Developer Portal for YouTrack and Hub 2021.3 Help

Article Attachments

This resource lets you work with attachments in a specific article.

Resource

/api/articles/{articleID}/attachments

Returned entity

ArticleAttachment. For the description of the entity attributes, see Supported Fields section.

Supported methods

ArticleAttachment attributes

Represents a file that is attached to an article or a comment to an article.

This table describes attributes of the ArticleAttachment entity.

  • To receive an attribute in the response from server, specify it explicitly in the request parameter fields.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

name

String

The name of the file. Can be null.

author

User

The user who attached the file to the article. Read-only. Can be null.

created

Long

The timestamp of the date and time when the attachment was created. Read-only.

updated

Long

The timestamp of the date and time when the attachment was last updated. Read-only.

size

Long

The size of the attached file in bytes. Read-only.

extension

String

The extension that defines the file type. Read-only. Can be null.

charset

String

The charset of the file. Read-only. Can be null.

mimeType

String

The MIME type of the file. Read-only. Can be null.

metaData

String

The dimensions of an image file. For an image file, the value is rw=&rh=. For a non-image file, the value is empty. Read-only. Can be null.

draft

Boolean

If true, the attachment is not yet published, otherwise false. Read-only.

removed

Boolean

If true, the attachment is considered to be removed. Read-only.

base64Content

String

The data URI that represents the attachment with the following syntax:

data:[<media type>][;base64],<data>

For example:

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
Can be null.

url

String

The URL of the file. Read-only. Can be null.

visibility

Visibility

The visibility settings of the attachment. Can be null.

article

BaseArticle

The article that the file is attached to. Read-only. Can be null.

comment

ArticleComment

The comment that the file is attached to. Returns null if the file was attached directly to the article. Read-only.

Read a List of ArticleAttachments

Get a list of all attachments to a specific article.

Required permissions

Requires access to the article where the attachment belongs.

Request syntax

GET /api/articles/{articleID}/attachments?{fields}&{$top}&{$skip}

Request parameters

Parameter

Type

Description

fields

String

A list of ArticleAttachment attributes that should be returned in the response. If no field is specified,only the entityID is returned

$skip

Int

Optional. Lets you set a number of returned entities to skip before returning the first one.

$top

Int

Optional. Lets you specify the maximum number of entries that are returned in the response.

Sample

Sample request

https://example.myjetbrains.com/youtrack/api/articles/NP-A-7/attachments?fields=id,name,author(id,name),created,updated,size,mimeType,extension,url

Sample response body

[ { "created": 1629978590790, "extension": "png", "author": { "name": "John Smith", "id": "24-0", "$type": "User" }, "updated": 1629978590790, "url": "/youtrack/api/files/237-3?sign=MTYzMDE5NTIwMDAwMHwyNC0wfDIzNy0zfFUtWDhBOGkyMF9uSTVRN2xTVHNzLWJBYjN2LUF2Y2pB%0D%0AUXYzSFc2bHRkeE0NCg%0D%0A%26updated=1629978590790", "mimeType": "image/png", "name": "jetbrains.png", "size": 64014, "id": "237-3", "$type": "ArticleAttachment" } ]

Add a New ArticleAttachment

Add an attachment to the article.

Required permissions

Requires Add Attachment permission.

Request syntax

POST /api/articles/{articleID}/attachments?{fields}&{muteUpdateNotifications}

Request parameters

Parameter

Type

Description

fields

String

A list of ArticleAttachment attributes that should be returned in the response. If no field is specified,only the entityID is returned

muteUpdateNotifications

Boolean

Set this parameter to true if no notifications should be sent on changes made by this request. This doesn't mute notifications sent by any workflow rules. Using this parameter requires Apply Commands Silently permission in all projects affected by the request. Available since 2021.3.

Sample

To create an attachment in an article, you need to send a POST request to an endpoint like the one specified in this sample. As the format for request differs for various languages and tools, we do not provide specific example here. Instead, please see a sample step-by-step procedure on the use case page.

Sample request

https://example.myjetbrains.com/youtrack/api/articles/NP-A-7/attachments?fields=id,name,author(id,name),created,updated,size,mimeType,extension,url
Last modified: 14 September 2021