Skip to content

Latest commit

 

History

History
253 lines (192 loc) · 13.5 KB

UploadsApi.md

File metadata and controls

253 lines (192 loc) · 13.5 KB

phrase_api.UploadsApi

All URIs are relative to https://api.phrase.com/v2

Method HTTP request Description
upload_create POST /projects/{project_id}/uploads Upload a new file
upload_show GET /projects/{project_id}/uploads/{id} Get a single upload
uploads_list GET /projects/{project_id}/uploads List uploads

upload_create

Upload upload_create(project_id, file, file_format, locale_id, x_phrase_app_otp=x_phrase_app_otp, branch=branch, tags=tags, update_translations=update_translations, update_translation_keys=update_translation_keys, update_descriptions=update_descriptions, convert_emoji=convert_emoji, skip_upload_tags=skip_upload_tags, skip_unverification=skip_unverification, file_encoding=file_encoding, locale_mapping=locale_mapping, format_options=format_options, autotranslate=autotranslate, mark_reviewed=mark_reviewed, tag_only_affected_keys=tag_only_affected_keys)

Upload a new file

Upload a new language file. Creates necessary resources in your project.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.UploadsApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    file = None # bytearray | File to be imported (required)
    file_format = 'file_format_example' # str | File format. Auto-detected when possible and not specified. (required)
    locale_id = 'locale_id_example' # str | Locale of the file's content. Can be the name or id of the locale. Preferred is id. (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
    branch = 'branch_example' # str | specify the branch to use
    tags = 'tags_example' # str | List of tags separated by comma to be associated with the new keys contained in the upload.
    update_translations = True # bool | Indicates whether existing translations should be updated with the file content.
    update_translation_keys = True # bool | Pass `false` here to prevent new keys from being created and existing keys updated. (default to True)
    update_descriptions = True # bool | Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions.
    convert_emoji = True # bool | This option is obsolete. Providing the option will cause a bad request error.
    skip_upload_tags = True # bool | Indicates whether the upload should not create upload tags.
    skip_unverification = True # bool | Indicates whether the upload should unverify updated translations.
    file_encoding = 'file_encoding_example' # str | Enforces a specific encoding on the file contents. Valid options are \\\"UTF-8\\\", \\\"UTF-16\\\" and \\\"ISO-8859-1\\\".
    locale_mapping = None # object | Mapping between locale names and translation columns. Required in some formats like CSV or XLSX.
    format_options = None # object | Additional options available for specific formats. See our format guide for complete list.
    autotranslate = True # bool | If set, translations for the uploaded language will be fetched automatically.
    mark_reviewed = True # bool | Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project.
    tag_only_affected_keys = False # bool | Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is `false` (default to False)

    try:
        # Upload a new file
        api_response = api_instance.upload_create(project_id, file, file_format, locale_id, x_phrase_app_otp=x_phrase_app_otp, branch=branch, tags=tags, update_translations=update_translations, update_translation_keys=update_translation_keys, update_descriptions=update_descriptions, convert_emoji=convert_emoji, skip_upload_tags=skip_upload_tags, skip_unverification=skip_unverification, file_encoding=file_encoding, locale_mapping=locale_mapping, format_options=format_options, autotranslate=autotranslate, mark_reviewed=mark_reviewed, tag_only_affected_keys=tag_only_affected_keys)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling UploadsApi->upload_create: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
file bytearray File to be imported
file_format str File format. Auto-detected when possible and not specified.
locale_id str Locale of the file's content. Can be the name or id of the locale. Preferred is id.
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]
branch str specify the branch to use [optional]
tags str List of tags separated by comma to be associated with the new keys contained in the upload. [optional]
update_translations bool Indicates whether existing translations should be updated with the file content. [optional]
update_translation_keys bool Pass `false` here to prevent new keys from being created and existing keys updated. [optional] [default to True]
update_descriptions bool Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions. [optional]
convert_emoji bool This option is obsolete. Providing the option will cause a bad request error. [optional]
skip_upload_tags bool Indicates whether the upload should not create upload tags. [optional]
skip_unverification bool Indicates whether the upload should unverify updated translations. [optional]
file_encoding str Enforces a specific encoding on the file contents. Valid options are \"UTF-8\", \"UTF-16\" and \"ISO-8859-1\". [optional]
locale_mapping object Mapping between locale names and translation columns. Required in some formats like CSV or XLSX. [optional]
format_options object Additional options available for specific formats. See our format guide for complete list. [optional]
autotranslate bool If set, translations for the uploaded language will be fetched automatically. [optional]
mark_reviewed bool Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project. [optional]
tag_only_affected_keys bool Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is `false` [optional] [default to False]

Return type

Upload

Authorization

Basic, Token

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Created * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

upload_show

Upload upload_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, branch=branch)

Get a single upload

View details and summary for a single upload.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.UploadsApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    id = 'id_example' # str | ID (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
    branch = 'my-feature-branch' # str | specify the branch to use

    try:
        # Get a single upload
        api_response = api_instance.upload_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, branch=branch)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling UploadsApi->upload_show: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
id str ID
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]
branch str specify the branch to use [optional]

Return type

Upload

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

uploads_list

List[Upload] uploads_list(project_id, x_phrase_app_otp=x_phrase_app_otp, page=page, per_page=per_page, branch=branch)

List uploads

List all uploads for the given project.

Example

from __future__ import print_function
import time
import phrase_api
from phrase_api.rest import ApiException
from pprint import pprint

configuration = phrase_api.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
configuration.api_key_prefix['Authorization'] = 'token'

# Enter a context with an instance of the API client
with phrase_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = phrase_api.UploadsApi(api_client)
    project_id = 'project_id_example' # str | Project ID (required)
    x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional)
    page = 1 # int | Page number
    per_page = 25 # int | Limit on the number of objects to be returned, between 1 and 100. 25 by default
    branch = 'my-feature-branch' # str | specify the branch to use

    try:
        # List uploads
        api_response = api_instance.uploads_list(project_id, x_phrase_app_otp=x_phrase_app_otp, page=page, per_page=per_page, branch=branch)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling UploadsApi->uploads_list: %s\n" % e)

Parameters

Name Type Description Notes
project_id str Project ID
x_phrase_app_otp str Two-Factor-Authentication token (optional) [optional]
page int Page number [optional]
per_page int Limit on the number of objects to be returned, between 1 and 100. 25 by default [optional]
branch str specify the branch to use [optional]

Return type

List[Upload]

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
* Link -
* Pagination -
400 Bad request * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
404 Not Found * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -
429 Rate Limiting * X-Rate-Limit-Limit -
* X-Rate-Limit-Remaining -
* X-Rate-Limit-Reset -

[Back to top] [Back to API list] [Back to Model list] [Back to README]