Project API

The Project API is composed of 1 endpoint:

Show Project

This endpoint is accessible by both private and public API keys and returns information about your project:

  • Project name,
  • Locales setup on that project,
  • The source locale,
  • For each file:
    • The file ids and file names.
    • The time of the file’s last modification.
    • The SHA-1 checksum of the file.

The call should be made using a GET request.

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

Where format is one of xml, json or yaml. Note that you can get a JSONP response by adding a ?callback=yourFunctionName parameter to the json API call.

Examples:

Data structure in 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
  - 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

Implementation Example in Ruby:

require 'net/http'
http = Net::HTTP.new('webtranslateit.com', 443)
http.use_ssl = true
request = Net::HTTP::Get("/api/projects/:api_token")
response = http.request(request)

Implementation Example in PHP:

<?php
  $api_key = "sekret";
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_URL, "https://webtranslateit.com/api/projects/" . $api_key . ".json");
  $response = curl_exec($ch);
  $p = json_decode($response, true);
  print_r($p);
  curl_close($ch);
?>