# Update article translations

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

Update translations for a knowledge article. Supports partial success.

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

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

### Request example

```bash
curl -X PATCH 'https://dev.dixa.io/v1/knowledge/articles/{articleId}/translations' \
  -H 'Authorization: <API token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "translations": [
    {
      "languageId": "en",
      "title": "My Article",
      "content": "<p>Hello world</p>"
    }
  ]
}'
```

### Response examples

#### 200 The updated translations, with partial errors if any

```json
{
  "data": [
    {
      "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"
    }
  ]
}
```

#### 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}/translations:
    patch:
      tags:
        - Knowledge
      summary: Update article translations
      description: Update translations for a knowledge article. Supports partial success.
      operationId: patchKnowledgeArticlesArticleidTranslations
      parameters:
        - name: articleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The translations to update for the article
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTranslationsInput"
        required: true
      responses:
        "200":
          description: The updated translations, with partial errors if any
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UpdateTranslationsOutput"
        "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:
    UpdateTranslationsInput:
      title: UpdateTranslationsInput
      type: object
      properties:
        translations:
          description: List of translations to create or update
          type: array
          items:
            $ref: "#/components/schemas/TranslationInput1"
    TranslationInput1:
      title: TranslationInput
      type: object
      required:
        - languageId
        - title
      properties:
        languageId:
          description: ISO language code (e.g. en, da, de)
          type: string
        title:
          description: Title of the translation
          type: string
        content:
          description: HTML content of the translation
          type: string
    UpdateTranslationsOutput:
      title: UpdateTranslationsOutput
      type: object
      properties:
        data:
          description: Successfully upserted translations
          type: array
          items:
            $ref: "#/components/schemas/ArticleTranslation"
        partialErrors:
          description: Errors for translations that failed
          type: array
          items:
            $ref: "#/components/schemas/TranslationError"
    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
    TranslationError:
      title: TranslationError
      type: object
      required:
        - languageId
        - message
      properties:
        languageId:
          description: Language code of the failed translation
          type: string
        message:
          description: Error message describing the failure
          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
```
