API V1 · Resources
Upload a resource file ZIP archive
curl --request POST \ --url https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: multipart/form-data' \ --form file=@translations.jsonimport requests
url = "https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip"
files = { "file": "open('translations.json', 'rb')" }headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.post(url, files=files, headers=headers)
print(response.json())const url = 'https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip';const form = new FormData();form.append('file', 'translations.json');
const options = {method: 'POST', headers: {Authorization: 'Bearer YOUR_API_KEY'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"translations.json\"\r\nContent-Type: application/json\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"translations.json\"\r\nContent-Type: application/json\r\n\r\n\r\n-----011000010111000001101001--\r\n");Request request = new Request.Builder() .url("https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip") .post(body) .addHeader("Authorization", "Bearer YOUR_API_KEY") .build();
Response response = client.newCall(request).execute();<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip', [ 'multipart' => [ [ 'name' => 'file', 'filename' => 'translations.json', 'contents' => null, 'headers' => [ 'Content-Type' => 'application/json' ] ] ] 'headers' => [ 'Authorization' => 'Bearer YOUR_API_KEY', ],]);
echo $response->getBody();require 'uri'require 'net/http'
url = URI("https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Post.new(url)request["Authorization"] = 'Bearer YOUR_API_KEY'request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"translations.json\"\r\nContent-Type: application/json\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)puts response.read_bodyusing System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/resources/zip"), Headers = { { "Authorization", "Bearer YOUR_API_KEY" }, }, Content = new MultipartFormDataContent { new StringContent("") { Headers = { ContentType = new MediaTypeHeaderValue("application/json"), ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "file", FileName = "translations.json", } } }, },};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}Uploads a ZIP archive containing multiple resource files to the specified project. The archive is extracted and all visible files within it are imported. Language detection is performed automatically based on file names and paths. Import behavior for source and target languages can be controlled through optional parameters.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”WorkspaceUrl
ProjectUrl
Query Parameters
Section titled “Query Parameters”If this file belongs to the source language: If new segments should be created
If this file belongs to the source language: If changed segments should be updated
If this file belongs to the source language: If removed segments should be deactivated
If this file belongs to the target language: If new segments should be created
If this file belongs to the target language: If changed segments should be updated
If this file belongs to the target language: If removed segments should be deactivated
Name of the project branch to import into. If omitted, the project’s default branch is used. Returns 422 if the branch name does not exist in the project.
Request Body
Section titled “Request Body”object
The zip file that will be uploaded
Responses
Section titled “Responses”Successfully uploaded and extracted the ZIP archive. All contained resource files have been scheduled for import.
Examples
Successful ZIP upload
ZipUploadSuccess
{ "status": "Success"}Bad Request: The ZIP archive is empty or contains no visible files.
Unauthorized: Authentication credentials are missing or invalid.
object
Example generated
{ "url": "example", "message": "example", "text": "example"}Forbidden: The authenticated user does not have resource management permission on this project.
object
Example generated
{ "url": "example", "message": "example", "text": "example"}Not Found: The specified workspace or project does not exist.
object
Example generated
{ "url": "example", "message": "example", "text": "example"}Unprocessable Entity: The specified branch name does not exist in the project, or an archive entry has an extension the project type cannot import (one files.invalid_extension error per entry, naming it).
object
object
object
object
object
object
Examples
Unsupported file extension
UnsupportedFile
{ "validationErrors": [ { "field": "files", "errors": [ { "code": "files.invalid_extension", "description": "File 'Resources.en.txt' has an unsupported extension; this project imports: resx, resw.", "parameters": { "file": "Resources.en.txt" } } ] } ]}Internal Server Error: An unexpected error occurred during the import process.
object
Example generated
{ "url": "example", "message": "example", "text": "example"}