Documentation

API

Project API

Show and create translation projects with the WebTranslateIt Project API, with curl, JavaScript, Python, Ruby and PHP examples. 4 min read

The Project API is composed of 2 endpoints:

Show Project

This endpoint is accessible by both read-write and read-only Project API keys and returns information about your project:

  • Project name,
  • Locales setup on that project,
  • The source language,
  • For each file:
    • The file ids and file names.
    • The time of the file’s last modification.
    • The SHA-1 checksum of the file.
    • fresh: displays if the file hosted on WebTranslateIt is up to date or needs to be regenerated.

The call should be made using a GET request.

/api/projects/:project_token.format [GET]

Where format is one of xml, json or yaml.

GET/api/projects/:project_token.json
curl "https://webtranslateit.com/api/projects/PROJECT_TOKEN.json"

Examples:

Data structure in YAML:

yaml
project:
  name: WebTranslateIt
  source_locale:
    name: English
    code: en
  target_locales:
  - name: French
    code: fr
    type: Locale
  id: 406
  project_files:
  - name: config/locales/app/en.yml
    updated_at: 2011-04-12 12:49:49 Z
    hash_file: 6ec3e8f72c5acfbbf2dbfe4e5d3014bd4144c541
    master_project_file_id:
    id: 56386
    locale_code: en
    fresh: true
  - name: config/locales/app/fr.yml
    updated_at: 2011-04-12 12:49:49 Z
    hash_file: 4e4ceeb4557a383dae1571f9d10c3336f92c4ff6
    master_project_file_id: 56386
    id: 56387
    locale_code: fr
    fresh: true

Create Project

This endpoint is accessible by the read-write Organization API.

The call should be made using a POST request. The Organization API token is passed as an organization_api_key parameter rather than in the path, because the project this call creates does not have a token yet.

/api/projects?organization_api_key=:organization_token [POST]

Parameters

A JSON object modelled after the following:

json
{
  "name": "Doughnut",
  "url": "https://doughnuts.com",
  "description": "A description of the project (Markdown can be used for formatting)",
  "icon": "An image file (optional, can be JPG, PNG or GIF)",
  "public": "false",
  "webhook": "https://webhook.com"
}
  • name: The project name (mandatory)
  • url: The project URL (optional). An URL linking to your project.
  • description: A project description (optional). Markdown can be used for formatting
  • icon: An image file (optional) passed as a multipart object
  • public: Optional. Sets if the project is open to the public. Can be "true" or "false". If unset, defaults to "false".
  • webhook: Optional. The URL of a webhook.
POST/api/projects?organization_api_key=:organization_token
curl -X POST "https://webtranslateit.com/api/projects?organization_api_key=ORGANIZATION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Doughnut",
    "url": "https://doughnuts.com",
    "public": "false"
  }'

If everything goes well, a JSON representation of your Project will be returned, including the project’s read-write and read-only API tokens.

json
{
  "project": {
        "name": "Doughnut",
        "id": 406,
        "created_at": "2022-02-24T23:23:11Z",
        "updated_at": "2022-02-24T23:23:11Z",
        "source_locale": { },
    "url": "https://doughnuts.com",
    "description": "A description of the project",
    "public": "false",
    "webhook": "http://webhook.com",
    "icon": "https://link_to_image"
  }
}