Skip to content

Commit 765d94a

Browse files
DEVORTEX-5656 Added POST method for /files/zip (#284)
1 parent fd6c17e commit 765d94a

File tree

1 file changed

+185
-1
lines changed

1 file changed

+185
-1
lines changed

spec/openapi.yaml

Lines changed: 185 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ paths:
18361836

18371837
'/files-api/v2/projects/{projectId}/files/zip':
18381838
get:
1839-
summary: Download multiple translated files
1839+
summary: Download multiple translated files (DEPRECATED)
18401840
description: |
18411841
Download ZIP archive with the requested translated files.
18421842

@@ -1982,6 +1982,190 @@ paths:
19821982
$ref: '#/components/responses/Error429ResponseDefinition'
19831983
500:
19841984
$ref: '#/components/responses/Error500ResponseDefinition'
1985+
post:
1986+
summary: Download multiple translated files
1987+
description: |
1988+
Download ZIP archive with the requested translated files.
1989+
1990+
This endpoint allows you to specify multiple files and locales in the
1991+
request body (limit is 500 file-locale combinations) to select which files
1992+
and languages you want to download.
1993+
1994+
It is important to check the HTTP response status code. If Smartling
1995+
finds and returns the file normally, you will receive a `200` SUCCESS
1996+
response. If you receive a `204` response, no files were included because
1997+
the requested files were not fully published and `fileFilter` was set to
1998+
`PUBLISHED_FILES_ONLY`. If you receive any other response status code
1999+
than `200`, the requested files will not be part of the response.
2000+
2001+
When you upload a UTF-16 character encoded file, then /file/get requests
2002+
for that file will have a character encoding of UTF-16. All other
2003+
uploaded files will return with a character encoding of UTF-8.
2004+
2005+
You can always use the content-type header in the response of a file/get
2006+
request to determine the character encoding.
2007+
2008+
**Example:**
2009+
2010+
```bash
2011+
curl -X POST \
2012+
-H "Authorization: Bearer {token}" \
2013+
-H "Content-Type: application/json" \
2014+
-d '{
2015+
"files": [
2016+
{
2017+
"fileUri": "yourfile.json",
2018+
"localeIds": ["de-DE", "fr-FR"]
2019+
},
2020+
{
2021+
"fileUri": "anotherfile.xml",
2022+
"localeIds": ["es-ES"]
2023+
}
2024+
],
2025+
"retrievalType": "published",
2026+
"includeOriginalStrings": true,
2027+
"fileNameMode": "LOCALE_LAST",
2028+
"localeMode": "LOCALE_IN_PATH",
2029+
"zipFileName": "translations.zip",
2030+
"fileFilter": "ALL_FILES"
2031+
}' \
2032+
'https://api.smartling.com/files-api/v2/projects/{projectId}/files/zip'
2033+
```
2034+
tags:
2035+
- Files
2036+
operationId: downloadMultipleTranslatedFilesPost
2037+
2038+
parameters:
2039+
- name: projectId
2040+
description: A unique project identifier. This can be found in the Smartling Dashboard under Account Settings > API.
2041+
in: path
2042+
required: true
2043+
schema:
2044+
type: string
2045+
2046+
requestBody:
2047+
required: true
2048+
content:
2049+
application/json:
2050+
schema:
2051+
type: object
2052+
required:
2053+
- files
2054+
properties:
2055+
files:
2056+
description: |
2057+
List of files with their associated locales to download.
2058+
At least one entry is required, each with at least one locale.
2059+
The total number of file-locale combinations cannot exceed 500.
2060+
type: array
2061+
minItems: 1
2062+
items:
2063+
type: object
2064+
required:
2065+
- fileUri
2066+
- localeIds
2067+
properties:
2068+
fileUri:
2069+
type: string
2070+
description: Smartling value that uniquely identifies a file.
2071+
localeIds:
2072+
type: array
2073+
description: List of locales to download for the given file. Must contain at least one element.
2074+
minItems: 1
2075+
items:
2076+
type: string
2077+
retrievalType:
2078+
description: |
2079+
Determines the desired format for the download. Applies only to
2080+
translated files.
2081+
2082+
| retrievalType | Description |
2083+
|---------------|-------------|
2084+
| pending | Smartling returns any translations (including non-published translations)|
2085+
| published | Smartling returns only published/pre-published translations.|
2086+
| pseudo | Smartling returns a modified version of the original text with certain characters transformed and the text expanded. For example, the uploaded string "This is a sample string", will return as "T~hís ~ís á s~ámpl~é str~íñg". Pseudo translations enable you to test how a longer string integrates into your application.|
2087+
| contextMatchingInstrumented | Smartling returns a modified version of the original file with strings wrapped in a specific set of Unicode symbols that can later be recognized and matched by the Chrome Context Capture Extension.|
2088+
type: string
2089+
enum:
2090+
- pending
2091+
- published
2092+
- pseudo
2093+
- contextMatchingInstrumented
2094+
includeOriginalStrings:
2095+
description: |
2096+
Specifies whether Smartling will return the original string or an
2097+
empty string where no translation is available. This parameter is
2098+
only supported for Android XML, gettext, Java properties, custom
2099+
XML, and JSON files.
2100+
2101+
| Value | Description |
2102+
|-------|-------------|
2103+
| true | If there is no translation, Smartling returns the original string. |
2104+
| false | If there is no translation, Smartling returns an empty string. |
2105+
type: boolean
2106+
fileNameMode:
2107+
description: |
2108+
Determines how files in the ZIP file will be named. If not set, the
2109+
full original file path will be used as the filename.
2110+
2111+
| fileNameMode | Description |
2112+
|--------------|-------------|
2113+
| UNCHANGED | Full original file path is used |
2114+
| TRIM_LEADING | Remove all except the last path segment. e.g. ```/en/strings/nav.properties``` becomes ```nav.properties```|
2115+
| LOCALE_LAST | Adds a locale folder to the file path directly before the filename. e.g. ```/strings/nav.properties``` becomes ```/strings/en/nav.properties``` |
2116+
type: string
2117+
enum:
2118+
- UNCHANGED
2119+
- TRIM_LEADING
2120+
- LOCALE_LAST
2121+
localeMode:
2122+
description: |
2123+
Determines how locales will be handled in the downloaded zip
2124+
2125+
| localeMode | Description |
2126+
|------------|-------------|
2127+
| LOCALE_IN_PATH | Locale code is added to the end of the file path. e.g. ```/strings/es-ES/nav.properties```. |
2128+
| LOCALE_IN_NAME | Locale code is added to the end of the file name e.g. ```/strings/nav_es-ES.properties```. |
2129+
| LOCALE_IN_NAME_AND_PATH | Locale code is added to both the path and the filename. e.g. ```/strings/es-ES/nav_es-ES.properties```. |
2130+
type: string
2131+
enum:
2132+
- LOCALE_IN_PATH
2133+
- LOCALE_IN_NAME
2134+
- LOCALE_IN_NAME_AND_PATH
2135+
zipFileName:
2136+
description: Name for the downloaded ZIP file. If unset, default is ```translations.zip```
2137+
type: string
2138+
fileFilter:
2139+
description: |
2140+
Specifies which files will be included in the response.
2141+
2142+
| Value | Description |
2143+
|--------|-------------|
2144+
| ALL_FILES | All requested files will be included in the response. |
2145+
| PUBLISHED_FILES_ONLY | Only fully published files will be included in the response. |
2146+
type: string
2147+
enum:
2148+
- ALL_FILES
2149+
- PUBLISHED_FILES_ONLY
2150+
2151+
responses:
2152+
200:
2153+
description: OK
2154+
content:
2155+
'*/*':
2156+
schema:
2157+
type: string
2158+
format: binary
2159+
204:
2160+
description: No content — returned when `fileFilter=PUBLISHED_FILES_ONLY` and none of the requested files are fully published.
2161+
400:
2162+
$ref: '#/components/responses/Error400ResponseDefinition'
2163+
401:
2164+
$ref: '#/components/responses/Error401ResponseDefinition'
2165+
429:
2166+
$ref: '#/components/responses/Error429ResponseDefinition'
2167+
500:
2168+
$ref: '#/components/responses/Error500ResponseDefinition'
19852169

19862170
'/files-api/v2/projects/{projectId}/files/list':
19872171
get:

0 commit comments

Comments
 (0)