Orders API

1. Place order

This API is used to place an order on Translate By humans.


Request Method  : POST 
ContentType : multipart/form-data
Requets Url : API_BASE_URL/API_VERSION/order/
Auth : Yes

        

You need to pass the following fields in your request to place an order:

  1. source_language_code:  Required
    Pass the source language code received from sourcelanguage call.
  2. destination_language_code:  Required
    Pass destination language code(s) retrieved from destinationlanguage call.
    Multiple language codes can be passed as comma-separated(,) values.
  3. category_id  Required
    Pass the category of your order here. Category must be one of the options retrieved from the category call.
  4. proof_reading  Optional
    Pass the proof reading language(s) of your choice retrieved from destinationlanguage call. Multiple languages can be passed with comma-separated(,) values.
  5. source_text  Optional if used Upload file
    The text that needs to be translated goes here. If you are uploading the file instead, you can skip this field.
  6. Upload file  Optional if used source_text
    You can upload a maximum of 3 files with specific names.
    document_1
    document_2
    document_3

Make sure the file names match here with the ones sent in the multipart request.


Request : POST
ContentType : application/x-www-form-urlencoded
Requets Url : API_BASE_URL/API_VERSION/order/
Auth : Yes

        

PHP SDK Example:


require_once 'tbh-sdk/TbhClient.php';
$apiclient = new TbhClient(CLIENT_ID,CLIENT_SECRET,CLIENT_PUBLIC,ACCESS_TOKEN);
$data = array(
    'source_language_code' => 'en',
    'destination_language_code' => 'th,de',
    'category_id' => '2',
    'source_text' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.    Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum',
    'prood_reading' => 'th',
);
$files = $_FILES;
$quote_data = $apiclient->PlaceOrder($data,$files);

        

Sample Output:


{
  "data": {
    "order_number": "TBH001034W",
    "source_language_code": "en",
    "destination_languages": [
      {
        "destination_language_code": "de",
        "total_word": 92,
        "proof_reading": "no",
        "total_credit_charge": 1380
      },
      {
        "destination_language_code": "th",
        "total_word": 92,
        "proof_reading": "yes",
        "total_credit_charge": 2024
      }
    ],
    "category_id": "2",
    "credit_used": 3404,
    "total_word_count": 92,
    "files": []
  },
  "message": "Success",
  "error_code": 0,
  "success": true
}

        

2. Get All Orders

This api is used to get all orders for the authenticated user.


Request Method  : Get
ContentType : application/x-www-form-urlencoded
Request Url : API_BASE_URL/API_VERSION/order/
Auth : Yes

require_once 'tbh-sdk/TbhClient.php';
$apiclient = new TbhClient(CLIENT_ID,CLIENT_SECRET,CLIENT_PUBLIC,ACCESS_TOKEN);
$source_data = $apiclient->GetAllOrders();

        

Sample Output:


{
  "data": [
      {
      "order_number": "TBH001012W",
      "order_date": "2016-12-07 15:14:10",
      "word_count": "168",
      "total_credit": "2520",
      "category_id": "2",
      "status": "New"
    },
    {
      "order_number": "TBH001013W",
      "order_date": "2016-12-07 15:16:09",
      "word_count": "168",
      "total_credit": "2520",
      "category_id": "2",
      "status": "New"
    }
  ],
  "message": "Success",
  "error_code": 0,
  "success": true
}

        

3. Get order details

This API is used to retrieve order details for a specific order id.


Request : GET
ContentType : application/x-www-form-urlencoded
Requets Url : API_BASE_URL/API_VERSION/order/ORDER_NUMBER
Auth : Yes

        

PHP SDK example


require_once 'tbh-sdk/TbhClient.php';
$apiclient = new TbhClient(CLIENT_ID, CLIENT_SECRET, CLIENT_PUBLIC, ACCESS_TOKEN);
$order_data = $apiclient->GetOrderDetail($orderno);

        

Sample output:


{
  "data": [
     {
      "order_date": "2017-04-17 11:03:17",
      "word_count": "92",
      "used_credit": 1380,
      "original_file": "https://api.translatebyhumans.com/index.php/V1/file/TBH000001W/original?token=YmYxZjlhNDUxNjg1ODg1ODFmYmQ1MTk2Yzg0ZDc5MGZmZjQ5YTc1MXw5YTYyNzczMDI3ZjY1M2ZlMDBmZTYxMDU3OThhNDlmNjY4NGE3OGJm",
      "translated_text":"",
      "translated_file": "https://api.translatebyhumans.com/index.php/V1/file/TBH000001W/translated?token=YmYxZjlhNDUxNjg1ODg1ODFmYmQ1MTk2Yzg0ZDc5MGZmZjQ5YTc1MXw5YTYyNzczMDI3ZjY1M2ZlMDBmZTYxMDU3OThhNDlmNjY4NGE3OGJm",
      "status": "Completed",
      "proof_reading": "no",
      "source_language_code": "en",
      "destination_language_code": "de"
    },
    {
      "order_date": "2017-04-17 11:03:17",
      "word_count": "92",
      "used_credit": 2024,
      "original_file": "https://api.translatebyhumans.com/index.php/V1/file/TBH000001W/original?token=YmYxZjlhNDUxNjg1ODg1ODFmYmQ1MTk2Yzg0ZDc5MGZmZjQ5YTc1MXw5YTYyNzczMDI3ZjY1M2ZlMDBmZTYxMDU3OThhNDlmNjY4NGE3OGJm",
      "translated_text":"",
      "translated_file": "https://api.translatebyhumans.com/index.php/V1/file/TBH000001W/translated?token=YmYxZjlhNDUxNjg1ODg1ODFmYmQ1MTk2Yzg0ZDc5MGZmZjQ5YTc1MXw5YTYyNzczMDI3ZjY1M2ZlMDBmZTYxMDU3OThhNDlmNjY4NGE3OGJm",
      "status": "Completed",
      "proof_reading": "yes",
      "source_language_code": "en",
      "destination_language_code": "th"
    }
  ],
  "message": "Success",
  "error_code": 0,
  "success": true
}


        
© 2019 Translate By Humans [Innovative Humans Limited]. All Rights Reserved.