Operations with Specific ArticleAttachment
This resource lets you work with attachments in a specific article.
Resource | /api/articles/{articleID}/attachments/{attachmentID} |
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.
Related Resources
Below you can find the list of resources that let you work with this entity.
Attributes
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 | User | 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:
data:[<media type>][;base64],<data>
For example:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
Can be null . |
url | String | The URL of the file. |
visibility | Visibility | The visibility settings of the attachment. |
article | BaseArticle | The article that the file is attached to. |
comment | ArticleComment | The comment that the file is attached to. Returns |
Read a Specific ArticleAttachment
Read a specific attachment in the article.
Required permissions
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.
Request syntax
{attachmentID} | The database ID of the attachment. |
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 |
Sample
Sample request
Sample response body
Update a Specific ArticleAttachment
Update a specific attachment.
Required permissions
The author of the attachment can always update it. Otherwise, requires the Update Attachment permission.
Request syntax
{attachmentID} | The database ID of the attachment. |
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 |
Sample
For an existing attachment, you can update only its name, visibility settings, and base64Content, if applicable. For this sample, we just re-name the attached image file.
Sample request
Sample request body
Sample response body
Delete a Specific ArticleAttachment
Delete a specific attachment.
Required permissions
The author of the attachment can always delete it. Otherwise, requires Delete Attachment permission.
Request syntax
{attachmentID} | The database ID of the attachment. |
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 |