Upload file to a batch
Changed onThis endpoint is actually a proxy for Upload File in the Files API, and it works with these two differences:
- It additionally gets batchUid as a path parameter.
- It doesn't relay localeIdsToAuthorize to Files Api, therefore the file stays unauthorized. Instead, localeIdsToAuthorize are saved just for this batch session and are used when a file is being attached to a job.
Upload is only possible if the file was declared in the Create Batch request or added with REGISTER_FILE action. When the first file is uploaded to the new batch, the batch status changes to ADDING_FILES. Adds original source content to a Job batch in Smartling.
The provided curl example will upload your Java properties file directly to a Smartling project, identified by the projectId, and attaches it to a Job linked to batchUid. The response is returned right after the content of a file is accepted by the Files API. After that, the Batch service controls whether the file upload finished. Content is parsed, all strings are ingested, and the file is then attached to the Job which is linked to the batch for locales, described in localeIdsToAuthorize.
Endpoint returns response as soon as a file is uploaded to job batches server. File is uploaded to FILE API asynchronously.
Common issues:
- Each file must include the fileUri registered with the batch, upon upload. For example, if you have created a batch with the single file URI test1.xml and you attempt to upload this with the file URI test2.xml it will fail, and you will get an error. But you can always use REGISTER_FILE action.
- File URI's must be unique per batch, even if you want to authorize it to two or more locales. For example, if you have file test1.xml that should be authorized for es and de, and you attempt to upload it twice (fileUri=test1.xml + localeIdsToAuthorize[]=es and fileUri=test1.xml + localeIdsToAuthorize[]=de), it will fail and you will get an error. The second upload will be rejected and file will be authorized only for es locale. You must always pass all desired locales with the registered fileUri (fileUri=test1.xml + localeIdsToAuthorize[]=es,de).
Request
- Base URLhttps://api.smartling.com
- AuthHTTP bearer
Path parameters
Unique identifier of a Smartling project — 9 lowercase alphanumeric characters.
A unique project identifier. This can be found in the Smartling Dashboard under Account Settings > API.
A unique identifier for a batch.
Request body multipart/form-data
Example request
{
"localeIdsToAuthorize[]": [
"fr-FR"
]
}Response
ACCEPTED
Changes
- info
endpoint added
- info