Article Attachments
This resource lets you work with attachments in a specific article.
Resource |
|
---|---|
Returned entity | ArticleAttachment. For the description of the entity attributes, see Supported Fields section. |
Supported methods |
Represents a file that is attached to an article or a comment to an article.
Below you can find the list of resources that let you work with this entity.
Article Attachments
This table describes attributes of the ArticleAttachment
entity.
To receive an attribute in the response from the server, specify it explicitly in the
fields
request parameter.To update an attribute, provide it in the body of a POST request.
Field | Type | Description |
---|---|---|
id | String | The ID of the article attachment. |
name | String | The name of the file. |
author | The user who attached the file to the article. | |
created | Long | The timestamp in milliseconds indicating the moment when the attachment was created. Stored as a unix timestamp at UTC. |
updated | Long | The timestamp in milliseconds indicating the last update of the attachment. Stored as a unix timestamp at UTC. |
size | Long | The size of the attached file in bytes. |
extension | String | The extension that defines the file type. |
charset | String | The charset of the file. |
mimeType | String | The MIME type of the file. |
metaData | String | The dimensions of an image file. For an image file, the value is |
draft | Boolean | If |
removed | Boolean | If |
base64Content | String | The data URI that represents the attachment with the following syntax:
For example:
|
url | String | The URL of the file. |
visibility | The visibility settings of the attachment. | |
article | The article that the file is attached to. | |
comment | The comment that the file is attached to. Returns |
Get a list of all attachments to a specific article.
Requires permissions: Read Article.
If the attachment is added to a comment, Read Comment is also required.
If the attachment visibility is limited to specific groups or users, only users from this set and the attachment author will be able to access the attachment. Override Visibility Restrictions permission allows to override these limitations.
GET /api/articles/{articleID}/attachments?{fields}&{$top}&{$skip}
null | Database ID of ArticleAttachment |
---|
Parameter | Type | Description |
---|---|---|
fields | String | A list of ArticleAttachment attributes that should be returned in the response. If no field is specified, only the |
$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. If you don't set the $top value, the server limits the maximum number of returned entries. The server returns a maximum of 42 entries for most resources that return collections. For more information, see Pagination. |
https://example.youtrack.cloud/api/articles/NP-A-7/attachments?fields=id,name,author(id,name),created,updated,size,mimeType,extension,url
[
{
"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 an attachment to the article.
Requires permissions: Add Attachment
POST /api/articles/{articleID}/attachments?{fields}&{muteUpdateNotifications}
null | Database ID of ArticleAttachment |
---|
Parameter | Type | Description |
---|---|---|
fields | String | A list of ArticleAttachment attributes that should be returned in the response. If no field is specified, only the |
muteUpdateNotifications | Boolean | Set this parameter to |
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.
https://example.youtrack.cloud/api/articles/NP-A-7/attachments?fields=id,name,author(id,name),created,updated,size,mimeType,extension,url