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

     1  ---
     2  summary: Create a key
     3  description: Create a new key.
     4  operationId: key/create
     5  tags:
     6  - Keys
     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_key_details.yaml#/translation_key_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/keys" \
    34        -u USERNAME_OR_ACCESS_TOKEN \
    35        -X POST \
    36        -F branch=my-feature-branch \
    37        -F name=home.index.headline \
    38        -F description=Some%20description%20worth%20knowing... \
    39        -F name_plural=home.index.headlines \
    40        -F data_type=number \
    41        -F tags=awesome-feature,needs-proofreading \
    42        -F max_characters_allowed=140 \
    43        -F screenshot=@/path/to/my/screenshot.png
    44        -F custom_metadata[property]=value
    45  - lang: CLI v2
    46    source: |-
    47      phrase keys create \
    48      --project_id <project_id> \
    49      --data '{"branch":"my-feature-branch", "name":"home.index.headline", "description": "Some description worth knowing...", "name_plural":"home.index.headlines", "data_type":"number", "tags":"awesome-feature,needs-proofreading", "max_characters_allowed":"140", "screenshot":"/path/to/my/screenshot.png", "custom_metadata": {"property" => "value"}}' \
    50      --access_token <token>
    51  requestBody:
    52    required: true
    53    content:
    54      application/json:
    55        schema:
    56          type: object
    57          title: key/create/parameters
    58          required:
    59            - name
    60          properties:
    61            branch:
    62              description: specify the branch to use
    63              type: string
    64              example: my-feature-branch
    65            name:
    66              description: Key name
    67              type: string
    68              example: home.index.headline
    69            description:
    70              description: Key description (usually includes contextual information for translators)
    71              type: string
    72              example: Some description worth knowing...
    73            plural:
    74              description: Indicates whether key supports pluralization
    75              type: boolean
    76              example:
    77            name_plural:
    78              description: Plural name for the key (used in some file formats, e.g. Gettext)
    79              type: string
    80              example: home.index.headlines
    81            data_type:
    82              description: 'Type of the key. Can be one of the following: string, number, boolean, array, markdown.'
    83              type: string
    84              example: number
    85            tags:
    86              description: List of tags separated by comma to be associated with the key.
    87              type: string
    88              example: awesome-feature,needs-proofreading
    89            max_characters_allowed:
    90              description: Max. number of characters translations for this key can have.
    91              type: integer
    92              example: 140
    93            screenshot:
    94              description: Screenshot/image for the key. This parameter is deprecated. Please use the Screenshots endpoint instead.
    95              type: string
    96              format: binary
    97              example: "/path/to/my/screenshot.png"
    98              deprecated: true
    99            remove_screenshot:
   100              description: Indicates whether the screenshot will be deleted. This parameter is deprecated. Please use the Screenshots endpoint instead.
   101              type: boolean
   102              example:
   103              deprecated: true
   104            unformatted:
   105              description: Indicates whether the key should be exported as "unformatted". Supported by Android XML and other formats.
   106              type: boolean
   107              example:
   108            default_translation_content:
   109              description: Creates a translation in the default locale with the specified content
   110              type: string
   111              example: Default translation content
   112            xml_space_preserve:
   113              description: Indicates whether the key should be exported with "xml:space=preserve". Supported by several XML-based formats.
   114              type: boolean
   115              example:
   116            original_file:
   117              description: Original file attribute. Used in some formats, e.g. XLIFF.
   118              type: string
   119              example:
   120            localized_format_string:
   121              description: NSStringLocalizedFormatKey attribute. Used in .stringsdict format.
   122              type: string
   123              example:
   124            localized_format_key:
   125              description: NSStringLocalizedFormatKey attribute. Used in .stringsdict format.
   126              type: string
   127              example:
   128            custom_metadata:
   129              description: Custom metadata property name and value pairs to be associated with key.
   130              type: object
   131              example:
   132                fruit: Apple
   133                vegetable: Tomato
   134  
   135  x-cli-version: '2.5'