Collect your translated content.

After creating a Translation Request, creating a quote or ordering a quote, we get access to retrieving the translations of said requests.

We can retrieve the translations in 2 different ways: using the id, the requests return to GET Translation Request or using the callback url:

  • GET Translation Request

    Using the id returned by the original POST request you can get back your translations.

  • Callback

    If you set the callback_url in your translation request you will be called back to that url once the translation is finished and reviewed.

We strongly advise that you use callbacks instead of getting the translations using GET to get the translations back into your system, seeing as callbacks provide a much better automated flow.

Example

The translation request you made in the previous example, is translated a few seconds after the request is made. This is applicable to any machine translation in general. This means that both getting Translation Request and using the callback url would return this:

{
  "id": 7,
  "name": null,
  "slug": "untitled-7",
  "context_url": null,
  "description": null,
  "created_at": "2016-03-02T10:23:32.441Z",
  "completed_at": "2016-03-02T10:23:32.638Z",
  "quality": "machine",
  "target_language_code": "tq",
  "style_guide_reference_id": 1,
  "status": "finished",
  "orders": [
    {
      "quality": "machine",
      "target_language_code": "tq",
      "status": "finished",
      "ordered_words": 22,
      "price": 0.0,
      "total_words": 22
    }
  ],
  "original": {
    "title": "The example",
    "intro": "An example on how to use Tolq",
    "body": "Tolq is a platform that allows you to easily translate lots of content"
  },
  "translations": {
    "tq": {
      "title": "Arcu pretium",
      "intro": "Et ultricies ex elit ut ante Vitae",
      "body": "Augue ut a consectetur magna lacus enim ac euismod elementum morbi eu lobortis"
    }
  },
  "total_orders": 1,
  "total_ordered_words": 22,
  "total_words": 22,
  "total_cost": 0.0,
  "total_keys": 3,
  "callback_response_code": null,
  "last_callback_at": null,
  "_links": {
    "review": [
      {
        "target_language_code": "tq",
        "target_language_name": "Tolq Latin",
        "href": "https://clients.tolq.com/api/7/review/tq"
      }
    ]
  }
}

Getting the request before translation

Callbacks are made only once the translation is finished and accepted. If you were to get the translation using the id earlier on, we might find out that the translation isn't yet available due to the different stages of the lifecycle.

An order that hasn't yet been paid would have this format:

{
  "id": 10,
  "name": null,
  "slug": "untitled-10",
  "context_url": null,
  "description": null,
  "created_at": "2016-03-02T12:33:30.678Z",
  "completed_at": null,
  "quality": "machine",
  "target_language_code": "es",
  "style_guide_reference_id": 1,
  "status": "unordered",
  "es": {
    "previous_words": 0,
    "new_words": 22,
    "total_words": 22,
    "cost": 0.07
  }
}