|
| 1 | +# phrase_api.PreTranslationsApi |
| 2 | + |
| 3 | +All URIs are relative to *https://api.phrase.com/v2* |
| 4 | + |
| 5 | +Method | HTTP request | Description |
| 6 | +------------- | ------------- | ------------- |
| 7 | +[**pre_translation_create**](PreTranslationsApi.md#pre_translation_create) | **POST** /projects/{project_id}/pre_translations | Create a pre-translation job |
| 8 | +[**pre_translation_show**](PreTranslationsApi.md#pre_translation_show) | **GET** /projects/{project_id}/pre_translations/{id} | Get a single pre-translation job |
| 9 | +[**pre_translations_list**](PreTranslationsApi.md#pre_translations_list) | **GET** /projects/{project_id}/pre_translations | List pre-translation jobs |
| 10 | + |
| 11 | + |
| 12 | +# **pre_translation_create** |
| 13 | +> PreTranslation pre_translation_create(project_id, pre_translation_create_parameters, x_phrase_app_otp=x_phrase_app_otp) |
| 14 | +
|
| 15 | +Create a pre-translation job |
| 16 | + |
| 17 | +Triggers a pre-translation job for a resource within a project, addressed by `translatable_type` (`locale`, `job`, `translation_key`, or `upload`) and `translatable_id` (its ID). Enqueues machine translation using the project's configured MT engine. |
| 18 | + |
| 19 | +### Example |
| 20 | + |
| 21 | +```python |
| 22 | +from __future__ import print_function |
| 23 | +import time |
| 24 | +import phrase_api |
| 25 | +from phrase_api.rest import ApiException |
| 26 | +from pprint import pprint |
| 27 | + |
| 28 | +configuration = phrase_api.Configuration() |
| 29 | +configuration.api_key['Authorization'] = 'YOUR_API_KEY' |
| 30 | +configuration.api_key_prefix['Authorization'] = 'token' |
| 31 | + |
| 32 | +# Enter a context with an instance of the API client |
| 33 | +with phrase_api.ApiClient(configuration) as api_client: |
| 34 | + # Create an instance of the API class |
| 35 | + api_instance = phrase_api.PreTranslationsApi(api_client) |
| 36 | + project_id = 'project_id_example' # str | Project ID (required) |
| 37 | + pre_translation_create_parameters = phrase_api.PreTranslationCreateParameters() # PreTranslationCreateParameters | (required) |
| 38 | + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) |
| 39 | + |
| 40 | + try: |
| 41 | + # Create a pre-translation job |
| 42 | + api_response = api_instance.pre_translation_create(project_id, pre_translation_create_parameters, x_phrase_app_otp=x_phrase_app_otp) |
| 43 | + pprint(api_response) |
| 44 | + except ApiException as e: |
| 45 | + print("Exception when calling PreTranslationsApi->pre_translation_create: %s\n" % e) |
| 46 | +``` |
| 47 | + |
| 48 | + |
| 49 | +### Parameters |
| 50 | + |
| 51 | +Name | Type | Description | Notes |
| 52 | +------------- | ------------- | ------------- | ------------- |
| 53 | + **project_id** | **str**| Project ID | |
| 54 | + **pre_translation_create_parameters** | [**PreTranslationCreateParameters**](PreTranslationCreateParameters.md)| | |
| 55 | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] |
| 56 | + |
| 57 | +### Return type |
| 58 | + |
| 59 | +[**PreTranslation**](PreTranslation.md) |
| 60 | + |
| 61 | +### Authorization |
| 62 | + |
| 63 | +[Basic](../README.md#Basic), [Token](../README.md#Token) |
| 64 | + |
| 65 | +### HTTP request headers |
| 66 | + |
| 67 | + - **Content-Type**: application/json |
| 68 | + - **Accept**: application/json |
| 69 | + |
| 70 | +### HTTP response details |
| 71 | +| Status code | Description | Response headers | |
| 72 | +|-------------|-------------|------------------| |
| 73 | +**202** | Accepted | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 74 | +**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 75 | +**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - | |
| 76 | +**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 77 | +**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 78 | +**422** | Unprocessable entity. The request was well-formed but failed validation. The response body lists each offending field in the `errors` array, with its resource, field, and a human-readable message. Correct the listed fields and retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 79 | +**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the `X-Rate-Limit-Reset` response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 80 | + |
| 81 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 82 | + |
| 83 | +# **pre_translation_show** |
| 84 | +> PreTranslation pre_translation_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match) |
| 85 | +
|
| 86 | +Get a single pre-translation job |
| 87 | + |
| 88 | +Returns a single pre-translation job identified by its ID. |
| 89 | + |
| 90 | +### Example |
| 91 | + |
| 92 | +```python |
| 93 | +from __future__ import print_function |
| 94 | +import time |
| 95 | +import phrase_api |
| 96 | +from phrase_api.rest import ApiException |
| 97 | +from pprint import pprint |
| 98 | + |
| 99 | +configuration = phrase_api.Configuration() |
| 100 | +configuration.api_key['Authorization'] = 'YOUR_API_KEY' |
| 101 | +configuration.api_key_prefix['Authorization'] = 'token' |
| 102 | + |
| 103 | +# Enter a context with an instance of the API client |
| 104 | +with phrase_api.ApiClient(configuration) as api_client: |
| 105 | + # Create an instance of the API class |
| 106 | + api_instance = phrase_api.PreTranslationsApi(api_client) |
| 107 | + project_id = 'project_id_example' # str | Project ID (required) |
| 108 | + id = 'id_example' # str | ID (required) |
| 109 | + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) |
| 110 | + if_modified_since = 'if_modified_since_example' # str | Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) |
| 111 | + if_none_match = 'if_none_match_example' # str | ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) |
| 112 | + |
| 113 | + try: |
| 114 | + # Get a single pre-translation job |
| 115 | + api_response = api_instance.pre_translation_show(project_id, id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match) |
| 116 | + pprint(api_response) |
| 117 | + except ApiException as e: |
| 118 | + print("Exception when calling PreTranslationsApi->pre_translation_show: %s\n" % e) |
| 119 | +``` |
| 120 | + |
| 121 | + |
| 122 | +### Parameters |
| 123 | + |
| 124 | +Name | Type | Description | Notes |
| 125 | +------------- | ------------- | ------------- | ------------- |
| 126 | + **project_id** | **str**| Project ID | |
| 127 | + **id** | **str**| ID | |
| 128 | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] |
| 129 | + **if_modified_since** | **str**| Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional] |
| 130 | + **if_none_match** | **str**| ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional] |
| 131 | + |
| 132 | +### Return type |
| 133 | + |
| 134 | +[**PreTranslation**](PreTranslation.md) |
| 135 | + |
| 136 | +### Authorization |
| 137 | + |
| 138 | +[Basic](../README.md#Basic), [Token](../README.md#Token) |
| 139 | + |
| 140 | +### HTTP request headers |
| 141 | + |
| 142 | + - **Content-Type**: Not defined |
| 143 | + - **Accept**: application/json |
| 144 | + |
| 145 | +### HTTP response details |
| 146 | +| Status code | Description | Response headers | |
| 147 | +|-------------|-------------|------------------| |
| 148 | +**200** | OK | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 149 | +**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 150 | +**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - | |
| 151 | +**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 152 | +**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 153 | +**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the `X-Rate-Limit-Reset` response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 154 | + |
| 155 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 156 | + |
| 157 | +# **pre_translations_list** |
| 158 | +> List[PreTranslation] pre_translations_list(project_id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match, page=page, per_page=per_page) |
| 159 | +
|
| 160 | +List pre-translation jobs |
| 161 | + |
| 162 | +Returns all pre-translation jobs scoped to a project, ordered by creation date descending. |
| 163 | + |
| 164 | +### Example |
| 165 | + |
| 166 | +```python |
| 167 | +from __future__ import print_function |
| 168 | +import time |
| 169 | +import phrase_api |
| 170 | +from phrase_api.rest import ApiException |
| 171 | +from pprint import pprint |
| 172 | + |
| 173 | +configuration = phrase_api.Configuration() |
| 174 | +configuration.api_key['Authorization'] = 'YOUR_API_KEY' |
| 175 | +configuration.api_key_prefix['Authorization'] = 'token' |
| 176 | + |
| 177 | +# Enter a context with an instance of the API client |
| 178 | +with phrase_api.ApiClient(configuration) as api_client: |
| 179 | + # Create an instance of the API class |
| 180 | + api_instance = phrase_api.PreTranslationsApi(api_client) |
| 181 | + project_id = 'project_id_example' # str | Project ID (required) |
| 182 | + x_phrase_app_otp = 'x_phrase_app_otp_example' # str | Two-Factor-Authentication token (optional) |
| 183 | + if_modified_since = 'if_modified_since_example' # str | Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) |
| 184 | + if_none_match = 'if_none_match_example' # str | ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) |
| 185 | + page = 1 # int | Page number |
| 186 | + per_page = 25 # int | Limit on the number of objects to be returned, between 1 and 100. 25 by default |
| 187 | + |
| 188 | + try: |
| 189 | + # List pre-translation jobs |
| 190 | + api_response = api_instance.pre_translations_list(project_id, x_phrase_app_otp=x_phrase_app_otp, if_modified_since=if_modified_since, if_none_match=if_none_match, page=page, per_page=per_page) |
| 191 | + pprint(api_response) |
| 192 | + except ApiException as e: |
| 193 | + print("Exception when calling PreTranslationsApi->pre_translations_list: %s\n" % e) |
| 194 | +``` |
| 195 | + |
| 196 | + |
| 197 | +### Parameters |
| 198 | + |
| 199 | +Name | Type | Description | Notes |
| 200 | +------------- | ------------- | ------------- | ------------- |
| 201 | + **project_id** | **str**| Project ID | |
| 202 | + **x_phrase_app_otp** | **str**| Two-Factor-Authentication token (optional) | [optional] |
| 203 | + **if_modified_since** | **str**| Last modified condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional] |
| 204 | + **if_none_match** | **str**| ETag condition, see [Conditional GET requests / HTTP Caching](/en/api/strings/pagination#conditional-get-requests-%2F-http-caching) (optional) | [optional] |
| 205 | + **page** | **int**| Page number | [optional] |
| 206 | + **per_page** | **int**| Limit on the number of objects to be returned, between 1 and 100. 25 by default | [optional] |
| 207 | + |
| 208 | +### Return type |
| 209 | + |
| 210 | +[**List[PreTranslation]**](PreTranslation.md) |
| 211 | + |
| 212 | +### Authorization |
| 213 | + |
| 214 | +[Basic](../README.md#Basic), [Token](../README.md#Token) |
| 215 | + |
| 216 | +### HTTP request headers |
| 217 | + |
| 218 | + - **Content-Type**: Not defined |
| 219 | + - **Accept**: application/json |
| 220 | + |
| 221 | +### HTTP response details |
| 222 | +| Status code | Description | Response headers | |
| 223 | +|-------------|-------------|------------------| |
| 224 | +**200** | OK | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> * Link - <br> * Pagination - <br> | |
| 225 | +**400** | Bad request. The request could not be parsed or a parameter failed validation. Verify the request body, the content type, and the parameter types, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 226 | +**401** | Unauthorized. Authentication failed because the access token is missing, expired, or invalid. Supply a valid access token and retry. | - | |
| 227 | +**403** | Forbidden. The credentials are valid but not permitted for this request: the access token may lack the required scope, the user may lack permission on the resource, or the account plan may not include the feature. Use a token with the required scope on an account and user that hold the necessary permissions. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 228 | +**404** | Not found. The requested resource does not exist or is not visible to the authenticated user. Verify the identifiers in the request path and that the token has access to them, then retry. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 229 | +**429** | Too many requests. The rate limit has been exceeded. Wait until the time indicated by the `X-Rate-Limit-Reset` response header before retrying. | * X-Rate-Limit-Limit - <br> * X-Rate-Limit-Remaining - <br> * X-Rate-Limit-Reset - <br> | |
| 230 | + |
| 231 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 232 | + |
0 commit comments