Add Attachment to an article

Overview

  • This API allows users to create a new internal attachment to be linked with article specified in the request.
  • User must have the required permissions to add attachments on the given article.

Permissions

  • User is allowed to add the attachments, only if they are allowed to edit the article specified in the request.

Preconditions:

  • Article must be checked out (locked) by the requesting user in the language requested (specified in $lang attribute) for 'Articles' and 'Accepted Article Suggestions'.
  • Language specified in $lang attribute must be assigned to the requesting user for 'Personal Article', 'Article Suggestions' and 'Article Suggestions Awaiting Feedback'.
  • Both article ID and $lang supplied in the query must exist and the article must exist in that language.
  • File type and size depends on the KB attachment policy configured in the system.
SecurityoAuthUser
Request
path Parameters
ID
required
string

The Id of the article on which operation is performed. Both numeric and alternate Id formats are supported for article Id.

Examples:
Providing readable article id.
PROD-2268
Providing numeric article id.
202200000002268
query Parameters
$lang
required
string

The knowledge base language used for retrieving response. Must be a language enabled in the system.

Enum: "en-US" "en-GB" "fr-FR" "es-ES" "it-IT" "de-DE" "nl-NL" "pt-BR" "pt-PT" "da-DK" "sv-SE" "ru-RU" "fr-CA" "zh-CN" "ja-JP" "ko-KR"
Example: $lang=en-US
header Parameters
Accept-Language
required
string
Default: en-US

Language locale accepted by client (used for locale specific fields in resource representation and in error responses).

Enum: "en-US" "es-ES" "fr-FR" "it-IT" "de-DE" "nl-NL" "pt-BR" "pt-PT" "da-DK" "ru-RU" "fr-CA" "zh-CN" "ja-JP" "ko-KR" "sv-SE"
Content-Type
required
string

Media type sent by the client.

Example: multipart/mixed; boundary=---------------------------638445380876140000
Request Body schema: multipart/mixed

The request body must be a multipart/mixed request, where :

  • One part must contain the xml request body
  • Other part must contain binary content of the attachment being uploaded.

The XML body must contain the following elements :

Name Description Type
name [ 1 .. 2000 ] characters Name of the attachment String
Schema not provided
Responses
201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

412

Preconditions failed

500

Internal server error

post/articles/{ID}/attachments
Request samples
multipart/mixed
-----------------------------638445380876140000 Content-Disposition: form-data; name="data" Content-Type: application/json Content-Length: 20
{ "name": "text.txt" } -----------------------------638445380876140000 Content-Disposition: form-data; name="file"; filename="text.txt" Content-Transfer-Encoding: binary Content-Type: text/plain Content-Length: 4
My time is now -----------------------------638445380876140000--
Response samples
application/json

Required query parameter is missing

{
  • "code": "400-112",
  • "developerMessage": "Required query parameter(s) is missing. The following parameters are required: <param name>"
}