API V1 · Repository
Push resource files to a repository
curl --request POST \ --url https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/push \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{ "branch": "main", "commitMessage": "Update translations for release 2.3.0", "commitDescription": "Includes updated French and German translations", "path": "/src/config/locales", "languageCode": "en", "pullRequestBranch": "lingohub/update-translations", "pullRequestTitle": "Update translations", "pullRequestDescription": "This PR updates the translation files exported from LingoHub."}'import requests
url = "https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/push"
payload = { "branch": "main", "commitMessage": "Update translations for release 2.3.0", "commitDescription": "Includes updated French and German translations", "path": "/src/config/locales", "languageCode": "en", "pullRequestBranch": "lingohub/update-translations", "pullRequestTitle": "Update translations", "pullRequestDescription": "This PR updates the translation files exported from LingoHub."}headers = { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const url = 'https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/push';const options = { method: 'POST', headers: {Authorization: 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json'}, body: '{"branch":"main","commitMessage":"Update translations for release 2.3.0","commitDescription":"Includes updated French and German translations","path":"/src/config/locales","languageCode":"en","pullRequestBranch":"lingohub/update-translations","pullRequestTitle":"Update translations","pullRequestDescription":"This PR updates the translation files exported from LingoHub."}'};
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/push"
payload := strings.NewReader("{\n \"branch\": \"main\",\n \"commitMessage\": \"Update translations for release 2.3.0\",\n \"commitDescription\": \"Includes updated French and German translations\",\n \"path\": \"/src/config/locales\",\n \"languageCode\": \"en\",\n \"pullRequestBranch\": \"lingohub/update-translations\",\n \"pullRequestTitle\": \"Update translations\",\n \"pullRequestDescription\": \"This PR updates the translation files exported from LingoHub.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer YOUR_API_KEY") req.Header.Add("Content-Type", "application/json")
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("application/json");RequestBody body = RequestBody.create(mediaType, "{\n \"branch\": \"main\",\n \"commitMessage\": \"Update translations for release 2.3.0\",\n \"commitDescription\": \"Includes updated French and German translations\",\n \"path\": \"/src/config/locales\",\n \"languageCode\": \"en\",\n \"pullRequestBranch\": \"lingohub/update-translations\",\n \"pullRequestTitle\": \"Update translations\",\n \"pullRequestDescription\": \"This PR updates the translation files exported from LingoHub.\"\n}");Request request = new Request.Builder() .url("https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/push") .post(body) .addHeader("Authorization", "Bearer YOUR_API_KEY") .addHeader("Content-Type", "application/json") .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/push', [ 'body' => '{ "branch": "main", "commitMessage": "Update translations for release 2.3.0", "commitDescription": "Includes updated French and German translations", "path": "/src/config/locales", "languageCode": "en", "pullRequestBranch": "lingohub/update-translations", "pullRequestTitle": "Update translations", "pullRequestDescription": "This PR updates the translation files exported from LingoHub."}', 'headers' => [ 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json', ],]);
echo $response->getBody();require 'uri'require 'net/http'
url = URI("https://api.lingohub.com/v1/WORKSPACE_URL/projects/PROJECT_URL/push")
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["Content-Type"] = 'application/json'request.body = "{\n \"branch\": \"main\",\n \"commitMessage\": \"Update translations for release 2.3.0\",\n \"commitDescription\": \"Includes updated French and German translations\",\n \"path\": \"/src/config/locales\",\n \"languageCode\": \"en\",\n \"pullRequestBranch\": \"lingohub/update-translations\",\n \"pullRequestTitle\": \"Update translations\",\n \"pullRequestDescription\": \"This PR updates the translation files exported from LingoHub.\"\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/push"), Headers = { { "Authorization", "Bearer YOUR_API_KEY" }, }, Content = new StringContent("{\n \"branch\": \"main\",\n \"commitMessage\": \"Update translations for release 2.3.0\",\n \"commitDescription\": \"Includes updated French and German translations\",\n \"path\": \"/src/config/locales\",\n \"languageCode\": \"en\",\n \"pullRequestBranch\": \"lingohub/update-translations\",\n \"pullRequestTitle\": \"Update translations\",\n \"pullRequestDescription\": \"This PR updates the translation files exported from LingoHub.\"\n}") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}Triggers pushing the project’s resource files to the linked repository. A repository connection (e.g. GitHub, GitLab, Bitbucket, or Azure DevOps) must have been configured for the project beforehand. The push can be performed either as a direct commit or as a pull/merge request depending on the configuration or the explicit pushType parameter.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”WorkspaceUrl
ProjectUrl
Request Bodyrequired
Section titled “Request Bodyrequired”The information needed to perform the push operation
object
Name of the branch to push to. If left empty, the default branch configured in the repository connection will be used.
Example
mainThe type of push to perform: PUSH for a direct commit, or PULL_REQUEST for creating a pull/merge request. If left empty, the project’s default push type will be used.
The commit message for the push. If left empty, a default commit message will be generated.
Example
Update translations for release 2.3.0An optional extended commit description providing additional context for the push.
Example
Includes updated French and German translationsRestrict the push to resource files under this path. If not set, all resource files of the project will be pushed.
Example
/src/config/localesRestrict the push to resource files of this locale. Specified as an ISO 639-1 code (e.g. ‘en’, ‘de-AT’) and matched against the project’s languages ignoring case, so ‘de-at’ selects ‘de-AT’. A code the project has no language for is rejected.
Example
enName of the branch to create for the pull/merge request. Only applicable when pushType is PULL_REQUEST.
Example
lingohub/update-translationsThe title of the pull/merge request. Only applicable when pushType is PULL_REQUEST.
Example
Update translationsThe description body of the pull/merge request. Only applicable when pushType is PULL_REQUEST.
Example
This PR updates the translation files exported from LingoHub.Responses
Section titled “Responses”Successfully triggered the push operation. Returns an empty body.
Bad Request: The project has no linked repository or the push parameters are invalid.
object
Example generated
{ "url": "example", "message": "example", "text": "example"}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 branch does not exist in the repository, or the project has no language with the given languageCode.
object
object
object
object
object
object
Example generated
{ "error": { "code": "example", "description": "example", "status": { "error": true, "is4xxClientError": true, "is5xxServerError": true, "is1xxInformational": true, "is2xxSuccessful": true, "is3xxRedirection": true } }, "validationErrors": [ { "field": "example", "errors": [ { "code": "example", "description": "example", "parameters": { "additionalProperty": "example" } } ] } ]}