# Update article

URL: https://docs.dixa.io/openapi/dixa-api/v1/knowledge/patchknowledgearticlesarticleid

Update a knowledge article

## PATCH /v1/knowledge/articles/{articleId}

- Server: https://dev.dixa.io
- Auth: `Authorization: <API token>` header

### Request example

```bash
curl -X PATCH 'https://dev.dixa.io/v1/knowledge/articles/{articleId}' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "ownedBy": "123e4567-e89b-12d3-a456-426614174000",
  "tags": {
    "add": [
      "tag-id-1"
    ]
  },
  "preRelease": false
}'
```

### Response examples

#### 200 The updated knowledge article

```json
{
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "isDefaultLocation": true,
    "translation": {
      "draft": {
        "language": "en",
        "title": "Getting Started",
        "isIndexedVersion": true,
        "contents": {
          "html": "<p>HTML content</p>",
          "plaintext": "plaintext content"
        },
        "availableAt": {
          "helpCenterLinks": [
            {
              "id": "112b5b9c-926a-4338-8963-0dc73d29dec7",
              "name": "Dixa Help Center",
              "url": "https://help.dixa.com"
            }
          ]
        },
        "createdAt": "2021-12-01T12:46:36.581Z[GMT]",
        "updatedAt": "2021-12-01T12:46:36.581Z[GMT]",
        "createdBy": "123e4567-e89b-12d3-a456-426614174000",
        "updatedBy": "123e4567-e89b-12d3-a456-426614174000"
      },
      "published": {
        "language": "en",
        "title": "Getting Started",
        "isIndexedVersion": true,
        "contents": {
          "html": "<p>HTML content</p>",
          "plaintext": "plaintext content"
        },
        "availableAt": {
          "helpCenterLinks": [
            {
              "id": "112b5b9c-926a-4338-8963-0dc73d29dec7",
              "name": "Dixa Help Center",
              "url": "https://help.dixa.com"
            }
          ]
        },
        "createdAt": "2021-12-01T12:46:36.581Z[GMT]",
        "updatedAt": "2021-12-01T12:46:36.581Z[GMT]",
        "createdBy": "123e4567-e89b-12d3-a456-426614174000",
        "updatedBy": "123e4567-e89b-12d3-a456-426614174000"
      }
    },
    "tags": [
      "f6020a03-5a7a-4d9e-81e6-f1b76a855a5e"
    ],
    "createdAt": "2021-12-01T12:46:36.581Z[GMT]",
    "updatedAt": "2021-12-01T12:46:36.581Z[GMT]",
    "indexedAt": "2021-12-01T12:46:36.581Z[GMT]",
    "createdBy": "123e4567-e89b-12d3-a456-426614174000",
    "updatedBy": "123e4567-e89b-12d3-a456-426614174000",
    "ownedBy": "123e4567-e89b-12d3-a456-426614174000",
    "indexedBy": "123e4567-e89b-12d3-a456-426614174000",
    "restrictions": {
      "isRestricted": true,
      "inheritedRestrictions": [
        {
          "fromCollection": "78dfb531-2e1e-4ffc-bd18-fdad68cd2419"
        }
      ]
    },
    "parentCategory": "123e4567-e89b-12d3-a456-426614174000",
    "parentCollections": [
      "78dfb531-2e1e-4ffc-bd18-fdad68cd2419"
    ]
  }
}
```

#### 400

```json
{
  "message": "Decoding failure in request"
}
```

#### 404 An entity in this request could not be found

```json
{
  "message": "The requested resource could not be found"
}
```

#### 500 Internal failure during request processing

```json
{
  "message": "There was an internal server error while processing the request"
}
```

## OpenAPI definition

The operation and the schemas used, from the full spec at https://docs.dixa.io/openapi-specs/dixa-v1.yaml. Request and response examples are above.

```yaml
openapi: 3.0.3
info:
  title: Dixa API
  version: v1
servers:
  - url: https://dev.dixa.io
security:
  - ApiKeyAuth: []
paths:
  /v1/knowledge/articles/{articleId}:
    patch:
      tags:
        - Knowledge
      summary: Update article
      description: Update a knowledge article
      operationId: patchKnowledgeArticlesArticleid
      parameters:
        - name: articleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The knowledge article fields to update
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateKnowledgeArticleInput"
        required: true
      responses:
        "200":
          description: The updated knowledge article
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateKnowledgeArticleOutput"
        "400":
          description: ""
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BadRequest"
        "404":
          description: An entity in this request could not be found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotFound"
        "500":
          description: Internal failure during request processing
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServerError"
      security:
        - ApiKeyAuth:
            - knowledge.content:w
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    UpdateKnowledgeArticleInput:
      title: UpdateKnowledgeArticleInput
      type: object
      properties:
        ownedBy:
          description: ID of the user who owns the article
          type: string
        tags:
          $ref: "#/components/schemas/TagsUpdateInput"
        preRelease:
          description: Whether the article is only available in pre-release mode
          type: boolean
    TagsUpdateInput:
      title: TagsUpdateInput
      description: Tags to add or remove
      type: object
      properties:
        add:
          description: Tag IDs to add
          type: array
          items:
            type: string
        remove:
          description: Tag IDs to remove
          type: array
          items:
            type: string
    UpdateKnowledgeArticleOutput:
      title: UpdateKnowledgeArticleOutput
      type: object
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/Article"
          description: The updated article
    Article:
      title: Article
      type: object
      required:
        - id
        - createdAt
        - updatedAt
        - restrictions
      properties:
        id:
          type: string
        isDefaultLocation:
          type: boolean
        translation:
          $ref: "#/components/schemas/Translation1"
        tags:
          type: array
          items:
            type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        indexedAt:
          type: string
          format: date-time
        createdBy:
          type: string
        updatedBy:
          type: string
        ownedBy:
          type: string
        indexedBy:
          type: string
        restrictions:
          $ref: "#/components/schemas/Restrictions"
        parentCategory:
          type: string
        parentCollections:
          type: array
          items:
            type: string
    Translation1:
      title: Translation
      type: object
      required:
        - draft
      properties:
        draft:
          $ref: "#/components/schemas/ArticleTranslation"
        published:
          $ref: "#/components/schemas/ArticleTranslation"
    ArticleTranslation:
      title: ArticleTranslation
      type: object
      required:
        - language
        - title
        - isIndexedVersion
        - contents
        - availableAt
        - createdAt
        - updatedAt
      properties:
        language:
          type: string
        title:
          type: string
        isIndexedVersion:
          type: boolean
        contents:
          $ref: "#/components/schemas/ArticleContent"
        availableAt:
          $ref: "#/components/schemas/AvailableAt"
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        createdBy:
          type: string
        updatedBy:
          type: string
    ArticleContent:
      title: ArticleContent
      type: object
      required:
        - html
        - plaintext
      properties:
        html:
          type: string
        plaintext:
          type: string
    AvailableAt:
      title: AvailableAt
      type: object
      properties:
        helpCenterLinks:
          type: array
          items:
            $ref: "#/components/schemas/HelpCenterLink"
    HelpCenterLink:
      title: HelpCenterLink
      type: object
      required:
        - id
        - name
        - url
      properties:
        id:
          type: string
        name:
          type: string
        url:
          type: string
    Restrictions:
      title: Restrictions
      type: object
      required:
        - isRestricted
      properties:
        isRestricted:
          description: "Whether a restriction is set directly on this item. The only
            restriction is internal use: the content is available only to
            logged-in users"
          type: boolean
        inheritedRestrictions:
          description: Restrictions inherited from parent collections or categories. When
            several parents have the same restriction, only the top-most parent
            is listed
          type: array
          items:
            $ref: "#/components/schemas/InheritedRestriction"
    InheritedRestriction:
      title: InheritedRestriction
      type: object
      properties:
        fromCollection:
          description: ID of the collection the restriction is inherited from. Empty if it
            comes from a category
          type: string
        fromCategory:
          description: ID of the category the restriction is inherited from. Empty if it
            comes from a collection
          type: string
    BadRequest:
      title: BadRequest
      type: object
      required:
        - message
      properties:
        message:
          type: string
    NotFound:
      title: NotFound
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ServerError:
      title: ServerError
      type: object
      required:
        - message
      properties:
        message:
          type: string
```
