Files Resource

Represents various types of translatable files to be processed by the server instead of the REST client. This REST interface provides endpoints for uploading and downloading files in multiple formats.

See Also
DocumentType
See Also
#fileTypeInfoList()

GET /file/accepted_document_types

This method has been deprecated.

Deprecated. A list of document types supported by the server. The result will not be deserializable if the server supports document types which the client does not know about (eg compiled against a newer version of zanata-api), also any changes to the list of supported file extensions for existing types will not be visible to the client.

See Also
DocumentType
See Also
#fileTypeInfoList()
Response Body
media type data type description
application/json array of object (JSON) a List of DocumentType

Example

Request
GET /file/accepted_document_types
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              
See Also
DocumentType#getSourceExtensions()
See Also
#fileTypeInfoList()

GET /file/accepted_types

This method has been deprecated.

Deprecated. Returns the source file extensions supported by the server.

See Also
DocumentType#getSourceExtensions()
See Also
#fileTypeInfoList()
Response Body
media type data type description
text/plain (custom) a semicolon-separated list of file extensions

Example

Request
GET /file/accepted_types
Accept: text/plain

              
Response
HTTP/1.1 200 OK
Content-Type: text/plain

                
...
                
              
See Also
FileTypeInfo

GET /file/file_type_info

A list of document types supported by the server, along with their default file extensions.

See Also
FileTypeInfo
Response Body
media type data type description
application/json array of object (JSON) a List of FileTypeInfo

Example

Request
GET /file/file_type_info
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

GET /file/download/{downloadId}

Downloads a previously generated file.

Request Parameters
name type description
downloadId path The Zanata generated download id.
Response Body
media type data type description
application/octet-stream (custom) The following response status codes will be returned from this operation:
OK(200) - A translation file in the requested format with translations for the requested document in a project, iteration and locale.
NOT FOUND(404) - If a downloadable file is not found for the given id, or is not yet ready for download (i.e. the system is still preparing it).
INTERNAL SERVER ERROR(500) - If there is an unexpected error in the server while performing this operation.

Example

Request
GET /file/download/{downloadId}
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

POST /file/source/{projectSlug}/{iterationSlug}

Upload a source file (or file chunk) to Zanata. Allows breaking up files into smaller chunks for very large files. In this case, the first invocation of this service will return an 'upload id' which needs to be used in subsequent calls to tie all the uploaded chunks together. The file will only be processed when all chunks have been fully uploaded. With each uploaded chunk, the multipart message's 'last' parameter will indicate if it is the last expected chunk.

Request Parameters
name type description
iterationSlug path The project version slug where to store the document.
projectSlug path The project slug where to store the document.
docId query The full Document identifier
Request Body
media type data type description
multipart/form-data (custom) The multi-part form body for the file or chunk.
Response Body
media type data type description
application/xml chunkUploadResponseType (XML) A message with information about the upload operation.

Example

Request
POST /file/source/{projectSlug}/{iterationSlug}
Content-Type: multipart/form-data
Accept: application/xml

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/xml

                
<chunkUploadResponse xmlns="http://zanata.org/namespace/api/">
  <uploadId>...</uploadId>
  <acceptedChunks>...</acceptedChunks>
  <expectingMore>...</expectingMore>
  <successMessage>...</successMessage>
  <errorMessage>...</errorMessage>
</chunkUploadResponse>

                
              

GET /file/source/{projectSlug}/{iterationSlug}/{fileType}

Downloads a single source file.

Request Parameters
name type description
fileType path use 'raw' for original source if available, or 'pot' to generate pot from source strings
iterationSlug path
projectSlug path
docId query
Response Body
media type data type description
application/octet-stream (custom) response with status code 404 if the document is not found, 415 if fileType is not valid for the document, otherwise 200 with attached document.

Example

Request
GET /file/source/{projectSlug}/{iterationSlug}/{fileType}
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

POST /file/translation/{projectSlug}/{iterationSlug}/{locale}

Upload a translation file (or file chunk) to Zanata. Allows breaking up files into smaller chunks for very large files. In this case, the first invocation of this service will return an 'upload id' which needs to be used in subsequent calls to tie all the uploaded chunks together. The file will only be processed when all chunks have been fully uploaded. With each uploaded chunk, the multipart message's 'last' parameter will indicate if it is the last expected chunk.

Request Parameters
name type description
iterationSlug path The project version slug where to store the document.
locale path The locale (language) for the translation file.
projectSlug path The project slug where to store the document.
docId query The full Document identifier.
merge query Indicates whether to merge translations or overwrite all translations with the contents of the uploaded file.
Request Body
media type data type description
multipart/form-data (custom) The multi-part form body for the file or chunk.
Response Body
media type data type description
application/xml chunkUploadResponseType (XML) A message with information about the upload operation.

Example

Request
POST /file/translation/{projectSlug}/{iterationSlug}/{locale}
Content-Type: multipart/form-data
Accept: application/xml

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/xml

                
<chunkUploadResponse xmlns="http://zanata.org/namespace/api/">
  <uploadId>...</uploadId>
  <acceptedChunks>...</acceptedChunks>
  <expectingMore>...</expectingMore>
  <successMessage>...</successMessage>
  <errorMessage>...</errorMessage>
</chunkUploadResponse>

                
              

GET /file/translation/{projectSlug}/{iterationSlug}/{locale}/{fileType}

Downloads a single translation file. To download a preview-document or translated document where a raw source document is available, use fileType 'half_baked' and 'baked' respectively.

Request Parameters
name type description
fileType path File type to be downloaded. (Options: 'po', 'half_baked', 'baked')
iterationSlug path Project iteration identifier.
locale path Translations for this locale will be contained in the downloaded document.
projectSlug path Project identifier.
docId query Document identifier to fetch translations for.
Response Body
media type data type description
application/octet-stream (custom) The following response status codes will be returned from this operation:
OK(200) - A translation file in the requested format with translations for the requested document in a project, iteration and locale.
NOT FOUND(404) - If a document is not found with the given parameters.
INTERNAL SERVER ERROR(500) - If there is an unexpected error in the server while performing this operation.

Example

Request
GET /file/translation/{projectSlug}/{iterationSlug}/{locale}/{fileType}
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...