Babelic API

This page is intended for programmers and advanced users. Otherwise, please go to our home.


Babelic displays serveral functionalities through a simple API , through which you will be able to integrate them in your system. For the time being we only have functionalities for "Client" user types, but soon we will add translator and proofreader functionalities.
This version 1.0 is still in beta and can be modified in future releases.

What can I do with this API?

The usual activities a client performs when they login into the website: look at their translations, cancel them, check their status, insert new texts, etc. etc.


Overview

The API’s base url is http://api.babelic.com/v1.svc. The username and password are the same ones you use to login normally, and if you wish to use the API you must let us know so we can activate your account. Otherwise, you will not be able to use it. The API is based on REST, which returns results in XML or JSON format, depending on the type specified in your request.
In the returns, besides the parameters, we assign a value to the http status code, so you must check it as well.

The format of the text inserted and returned is HTML, so in order to insert a new line you must add a label
. You can also include links, etc. etc.



Authentication

The username and password to access the API are the same ones you use to access the web with a browser. You login using HTTP basic authentication. We do not use API keys or any other kind of system like OAuth.


Available features

Customers/Translations:Returns all translations to the client.


  • Url:http://api.babelic.com/v1.svc/customers/translations
  • Method:Get
  • Parameters: Does not apply
  • Return: Returns an array of objects TranslationDataType
  • Note: With this method, TranslationDataType objects are not loaded with the translatedText property. Also, the translatedText property is only loaded with the first characters of the text in order to save broadband. To receive these loaded fields, use the following method.

Customers/Translations/show: Returns a translation


  • Url:http://api.babelic.com/v1.svc/customers/translations/show
  • Method:Get
  • Parameters: id- translation id requested
  • Return: Returns an object TranslationDataType.

Customers/Balance: Returns the client’s balance. In other words, the account money they will use to pay for translations.


  • Url:http://api.babelic.com/v1.svc/customers/balance
  • Method:Get
  • Parameters: Does not apply
  • Return: Returns the client’s balance in decimal format.

Customers/translations/cancel: Cancels a translation job


  • Url:http://api.babelic.com/v1.svc/customers/translations/cancel
  • Method:Get
  • Parameters: id-> id of the translation you would like to cancel.
  • Return: Does not apply. Example: [4]
  • Note: Only unpaid translations can be cancelled, and therefore their status is “uploaded”. To find out whether the translation has been cancelled after being requested, check the http status code; it must be 200 (OK) or you can also perform a request for that translation and check it.

Customers/translations/new: Create a new translation

  • Url:http://api.babelic.com/v1.svc/customers/translations/new
  • Method:Post
  • Parameters: idLanguagePair->id of the language pair to translate [5],text-> text to translate, callback->; optional, url called by Babelic when the translation is done, valid for notification, maximum URL length is 150 characters, testing->;optional (false by default), used to test the API without having to pay for translations. If the value is true, the translation is created as a test and the client’s account is not charged. The same value is assigned to the translated text and the original text, and the client receives it as finished. To confirm the translation was entered as test, you can check the balance and then make the call; the two amounts must match.
  • Return: Returns a TranslationDataType object with the translation’s information.
    Note: In the source text, the whole submitted text is not returned, only its heading

Reference

Examples are given in XML format, but it is also possible to receive these messages in JSON

Object TranslationDataType:


<translationDataType>
<dateAdded/>
<dateFinished/>
<id/>
<idCoin/>
<idLanguagePair/>
<idStatus/>
<sourceText/>
<totalPrice/>
<translatedText/>
<wordsNumber/>
<callback/>
</translationDataType>

Possible types of idStatus:


ID Status Explanation
25 Registration Initial status, translation can be cancelled
15 In progress The translation is paid for and the translation process begins
55 Rejected by the system
119 System error
227 System error
226 Cancelled
228 Cancelled and amount refunded
229 Cancelled and amount refunded
101 Completed The translation has been done correctly

Possible types of idLanguagePairs:


ID Source language Target language
8 Spanish English
9 English Spanish
19 Spanish German
20 German Spanish
21 Spanish French
22 French Spanish
23 Spanish Italian
24 Italian Spanish

Examples

Translations

  • Url:http://api.babelic.com/v1.svc/customers/translations
  • Return:
    <translationDataType>
    <dateAdded>2008-03-02T14:08:38.447</dateAdded>
    <dateFinished>2008-12-03T02:38:51.297</dateFinished>
    <id>7630</id>
    <idCoin>1</idCoin>
    <idLanguagePair>8</idLanguagePair>
    <idStatus>101</idStatus>
    <sourceText>En este reciente articulo de<sourceText>
    <totalPrice>3.45</totalPrice>
    <translatedText i:nil="true"/>
    <wordsNumber>50</wordsNumber>
    </translationDataType>
    <translationDataType>
    <dateAdded>2008-03-02T15:45:37.757</dateAdded>
    <dateFinished i:nil="true"/>
    <id>7631</id>
    <idCoin>1</idCoin>
    <idLanguagePair>8</idLanguagePair>
    <idStatus>25</idStatus>
    <sourceText> Algunas reflexiones sobre el cierre de la re</sourceText>
    <totalPrice>2.58</totalPrice>
    <translatedText i:nil="true"/>
    <wordsNumber>206</wordsNumber>
    </translationDataType> </translationDataType>

Translation

  • Url:http://api.babelic.com/v1.svc/customers/translations/show?id=7630
  • Return:
    <translationDataType>
    <dateAdded>2008-03-02T14:08:38.447</dateAdded>
    <dateFinished>2008-12-03T02:38:51.297</dateFinished>
    <id>7630</id>
    <idCoin>1</idCoin>
    <idLanguagePair>8</idLanguagePair>
    <idStatus>101</idStatus>
    <sourceText>
    A estas alturas de la película es difícil encontrar proyectos que aporten algo realmente novedoso, desconozco si hay sitios similares en inglés (supongo que si) pero a mi al menos me ha gustado descubrir pqpq.es por se una nueva forma de participación e intercambio de opiniones en la web.
    </sourceText>
    <totalPrice>3.45</totalPrice>
    <translatedText/>
    <wordsNumber>50</wordsNumber>
    </translationDataType>

Balance

  • Url:http://api.babelic.com/v1.svc/customers/balance
  • Return:
    <decimal>841.47</decimal>

Cancel translation

  • Url:http://api.babelic.com/v1.svc/customers/translations/cancel?id=7630
  • Return: Does not apply, the http status code must be checked

New translation

  • Url:http://api.babelic.com/v1.svc/customers/translations/new,using Post to send as parameters the idLanguagePair8, the “translation test” text and callback tohttp://www.myweb/translationHandler/25
  • Return:
    <translationDataType>
    <dateAdded>2008-03-02T14:08:38.447</dateAdded>
    <dateFinished>2008-12-03T02:38:51.297</dateFinished>
    <id>7630</id>
    <idCoin>1</idCoin>
    <idLanguagePair>8</idLanguagePair>
    <idStatus>25</idStatus>
    <sourceText>prueba de traducción<sourceText>
    <totalPrice>3.45</totalPrice>
    <translatedText i:nil="true"/>
    <callback>http://www.myweb/translationHandler/25</callback>
    <wordsNumber>200</wordsNumber>
    </translationDataType>

Errors, improvements and suggestions

You can always get in touch with us by writing to