Exports
The SDK provides methods for creating exports, listing them, checking their status, and retrieving download URLs.
Exports are processed asynchronously. After creating an export, you can check its status and request a download URL once it has completed.
Create an export
Section titled “Create an export”Use create_export to start exporting a project:
export = client.create_export('project-id')
puts export.export_idputs export.statusReturns a LokaliseApiNext::Models::Vantage::Export object. The initial status is IN_PROGRESS.
By default, the entire project is exported for all available languages. You can restrict the export to specific locales:
export = client.create_export( 'project-id', locales: ['fr', 'de-DE'])Alternatively, specify language IDs:
export = client.create_export( 'project-id', languageIds: ['language-id-1', 'language-id-2'])You can also export specific items, each with its own language selection:
export = client.create_export( 'project-id', items: [ { itemId: 'item-id-1', locales: ['fr'] }, { itemId: 'item-id-2', locales: ['de-DE'] } ])The locales, languageIds, and items options represent alternative export selections. Refer to the API documentation for supported combinations and limits.
List exports
Section titled “List exports”Use exports to retrieve exports belonging to a project:
exports = client.exports('project-id')
exports.each do |export| puts "#{export.export_id}: #{export.status}"endReturns a LokaliseApiNext::Collections::Vantage::Exports collection containing LokaliseApiNext::Models::Vantage::Export objects.
You can filter exports by status:
exports = client.exports( 'project-id', 'filter-status': 'COMPLETED', limit: 20)Supported statuses are IN_PROGRESS, COMPLETED, and FAILED. You can also filter by export IDs using filter-ids.
Pagination
Section titled “Pagination”The exports method supports cursor-based pagination.
For example, retrieve up to 20 exports:
exports = client.exports('project-id', limit: 20)To retrieve the next page, pass the returned cursor:
if exports.more? next_page = client.exports( 'project-id', limit: 20, after: exports.cursor )endWhen filtering exports, preserve the filter parameters in subsequent requests.
Retrieve an export
Section titled “Retrieve an export”Use export to retrieve the current status and details of a specific export:
export = client.export('project-id', 'export-id')
puts export.export_idputs export.statusputs export.created_atputs export.total_items_countputs export.processed_items_countputs export.fail_reasonReturns a LokaliseApiNext::Models::Vantage::Export object.
An export can have one of three statuses:
IN_PROGRESS— The export is still being processed.COMPLETED— Processing has finished. Checkprocessed_items_countagainsttotal_items_count, as some selected items may not have been exported.FAILED— The export failed. Checkfail_reasonfor details.
The SDK does not automatically poll for export completion. You can call export again to check the latest status.
Get an export download URL
Section titled “Get an export download URL”Use export_download_url to retrieve the download URL for a completed export:
result = client.export_download_url('project-id', 'export-id')
puts result.download_urlReturns a LokaliseApiNext::Models::Vantage::ExportDownloadUrl object.
The URL is temporary, so retrieve a new one if it expires. The SDK returns the URL but does not automatically download the exported file.
If the export is still being processed or no downloadable file is available, the API may return an error, which the SDK handles through LokaliseApiNext::Error.
Example: Create and download an export
Section titled “Example: Create and download an export”Here’s how the methods fit together:
export = client.create_export( 'project-id', locales: ['fr'])
# Check the status later.export = client.export('project-id', export.export_id)
if export.status == 'COMPLETED' result = client.export_download_url( 'project-id', export.export_id )
puts result.download_urlelsif export.status == 'FAILED' puts export.fail_reasonendFor more information about request parameters and response fields, refer to the linked API documentation.