github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/paths/translations/create.yaml (about)

     1  ---
     2  summary: Create a translation
     3  description: Create a translation.
     4  operationId: translation/create
     5  tags:
     6  - Translations
     7  parameters:
     8  - "$ref": "../../parameters.yaml#/X-PhraseApp-OTP"
     9  - "$ref": "../../parameters.yaml#/project_id"
    10  responses:
    11    '201':
    12      description: Created
    13      content:
    14        application/json:
    15          schema:
    16            "$ref": "../../schemas/translation_details.yaml#/translation_details"
    17      headers:
    18        X-Rate-Limit-Limit:
    19          "$ref": "../../headers.yaml#/X-Rate-Limit-Limit"
    20        X-Rate-Limit-Remaining:
    21          "$ref": "../../headers.yaml#/X-Rate-Limit-Remaining"
    22        X-Rate-Limit-Reset:
    23          "$ref": "../../headers.yaml#/X-Rate-Limit-Reset"
    24    '400':
    25      "$ref": "../../responses.yaml#/400"
    26    '404':
    27      "$ref": "../../responses.yaml#/404"
    28    '429':
    29      "$ref": "../../responses.yaml#/429"
    30  x-code-samples:
    31  - lang: Curl
    32    source: |-
    33      curl "https://api.phrase.com/v2/projects/:project_id/translations" \
    34        -u USERNAME_OR_ACCESS_TOKEN \
    35        -X POST \
    36        -d '{"branch":"my-feature-branch","locale_id":"abcd1234cdef1234abcd1234cdef1234","key_id":"abcd1234cdef1234abcd1234cdef1234","content":"My translation"}' \
    37        -H 'Content-Type: application/json'
    38  - lang: CLI v2
    39    source: |-
    40      phrase translations create \
    41      --project_id <project_id> \
    42      --data '{"branch":"my-feature-branch", "locale_id":"abcd1234cdef1234abcd1234cdef1234", "key_id":"abcd1234cdef1234abcd1234cdef1234", "content": "My translation"}' \
    43      --access_token <token>
    44  requestBody:
    45    required: true
    46    content:
    47      application/json:
    48        schema:
    49          type: object
    50          title: translation/create/parameters
    51          properties:
    52            branch:
    53              description: specify the branch to use
    54              type: string
    55              example: my-feature-branch
    56            locale_id:
    57              description: Locale. Can be the name or id of the locale. Preferred is id
    58              type: string
    59              example: abcd1234cdef1234abcd1234cdef1234
    60            key_id:
    61              description: Key
    62              type: string
    63              example: abcd1234cdef1234abcd1234cdef1234
    64            content:
    65              description: Translation content
    66              type: string
    67              example: My translation
    68            plural_suffix:
    69              description: 'Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized.'
    70              type: string
    71              example:
    72            unverified:
    73              description: Indicates whether translation is unverified. Part of the <a href="https://support.phrase.com/hc/en-us/articles/5784094755484" target="_blank">Advanced Workflows</a> feature.
    74              type: boolean
    75              example:
    76            excluded:
    77              description: Indicates whether translation is excluded.
    78              type: boolean
    79              example:
    80            autotranslate:
    81              description: Indicates whether the translation should be auto-translated. Responses with status 422 if provided for translation within a non-default locale or the project does not have the Autopilot feature enabled.
    82              type: boolean
    83              example:
    84  x-cli-version: '2.5'