Skip to content

API V1

Repository

Endpoint to push resource files to a repository

The push operation writes the files of a project to the repository that is connected to it. It needs the resourcesManage permission on the project.

Before you push

Connect a repository to the project in LingoHub first. LingoHub supports GitHub, GitLab, Bitbucket, Azure DevOps and AWS CodeCommit.

How a push runs

The request schedules the push and answers 200 with an empty body. The push itself runs in the background, so 200 doesn’t mean that the commit or the pull request already exists.

LingoHub checks the repository during the request only if you send branch: the project must be connected to a repository, the branch must exist, and a protected branch can’t be the target of a direct PUSH. Without branch, LingoHub accepts the request without these checks, and a push that can’t run fails in the background.

Request body

The body is required. Send {} to use the project’s settings for everything.

Field Meaning
pushType PUSH commits to the branch; PULL_REQUEST opens a pull request or merge request. Default: the push type of the project.
branch The repository branch to push to. Default: the branch of the repository connection.
commitMessage, commitDescription Message and extended description of the commit. Without a message, LingoHub generates one.
path Pushes only the files whose path starts with this value. LingoHub compares the paths literally, as Get project resource file status returns them in filePathWithLocalePlaceholder: src/config/locales doesn’t match if you write it as /src/config/locales.
languageCode Pushes only the files of this language. The code must be a language of the project; LingoHub ignores case, so de-at selects de-AT.
pullRequestBranch, pullRequestTitle, pullRequestDescription Branch, title and description of the pull request. Used only with PULL_REQUEST.
{
  "branch": "main",
  "pushType": "PULL_REQUEST",
  "commitMessage": "Update translations for release 2.3.0",
  "commitDescription": "Includes updated French and German translations",
  "pullRequestBranch": "lingohub/update-translations",
  "pullRequestTitle": "Update translations",
  "pullRequestDescription": "This PR updates the translation files exported from LingoHub.",
  "path": "src/config/locales",
  "languageCode": "en"
}

Responses

Status Meaning
200 LingoHub scheduled the push. The body is empty.
400 The body is missing or isn’t valid JSON, or pushType has another value than PUSH or PULL_REQUEST.
401 The API key is missing or invalid.
403 The key lacks the resourcesManage permission on the project.
404 The workspace or the project doesn’t exist.
422 With branch: the project isn’t connected to a repository, the branch doesn’t exist, or it is protected and the push type is PUSH. With languageCode: the project has no such language.

Operations

Operation Request
Push resource files to a repository POST /v1/{workspaceUrl}/projects/{projectUrl}/push