REST API v1

Authentication

LingoHub offers two authentication methods with our API:

  1. Token Authentication
  2. HTTP Authentication

The two methods of authentication are supported equally. If you wish to change your authentication details (username, email, password, token) you can do so on your Account Settings page.

Token Authentication

You can add the URL parameter ‘auth_token’ to your request for authentication. You can find your API token value your API on your Account Settings page.

curl -X GET https://api.lingohub.com/v1/projects.json?auth_token=cb26a0249f6953a...

HTTP Authentication

HTTP supports the use of several authentication mechanisms to control access to pages and other resources. These mechanisms are all based around the use of the 401 status code and the WWW-Authenticate response header. The client sends the username and password as unencrypted, base64-encoded text. Because it is unencrypted, it should only be used with HTTPS, as the password can be easily captured and reused over HTTP.
Luckily, LingoHub encrypts all communication with SSL.

curl -X GET https://api.lingohub.com/v1/projects.json -u [email protected]:password

HTTP Status Codes

For each request LingoHub API tries to return suitable HTTP status codes. Response codes for the REST API can be suppressed.

  • 200 OK: Success!
  • 304 Not Modified: No new data was found.
  • 400 Bad Request: Your request was not valid. There will be an explanatory error message. This is the status code; during rate limiting it will be returned
  • 401 Unauthorized: There are missing or incorrect authentication credentials.
  • 403 Forbidden: Your request was understood, but it has been refused. There will be an explanatory error message.This code is used when requests are being refused due to update limits.
  • 404 Not Found: The URI requested is not valid or the requested resource, a user for example, does not exist.
  • 406 Not Acceptable: If an invalid format is specified in the request the search API will return this code.
  • 500 Internal Server Error: Please inform the LingoHub Support team who will investigate as something is damaged.

Error Messages

When the LingoHub API returns error messages, it does so in your requested format. For example, an error from a JSON method might look like this:

{"error": "The 'page_size' parameter must be between 1 and 100 but was -1"}

Request Rate Limiting

To protect LingoHub from abuse the API usage is rate-limited, with additional fair use limits.

Projects

Project's details

GET /v1/{accountUrl}/projects/{projectUrl}

Retrieves the detailed information of the specified project

New project

POST /v1/{accountUrl}/projects

Creates a new project

Request

The information needed to create the project

{
  "description": "The information needed to create the project",
  "content": {
    "*/*": {
      "schema": {
        "$ref": "#/components/schemas/CreateProjectRequest"
      }
    }
  },
  "required": true
}

Projects' list

GET /v1/projects

Retrieves a list of projects of the authenticated user.

Projects' informations

GET /v1/{accountUrl}/projects/status

Retrieves a list of the specified organization's projects with the standard attributes for each of them (title, url...) and the different translation statuses.

Project's status

GET /v1/{accountUrl}/projects/{projectUrl}/status

Retrieves the translation's status of the specified project

Resources

Resource files list

/v1/{accountUrl}/projects/{projectUrl}/resources

Returns the list of the resource files of a given project.

Upload resource file

/v1/{accountUrl}/projects/{projectUrl}/resources

Uploads the given resource file to the specified project.

Download resource file

/v1/{accountUrl}/projects/{projectUrl}/resources/{fileName}

Downloads the requested resource file

Sessions

Session

/v1/sessions

Retrieves session information