Retrieving a Transcription Result

πŸ“œ Get Transcription Result API

Once you've uploaded your audio or video files, you'll need a convenient and reliable way to retrieve the transcriptions. That's where our Get Transcription Result API comes in.

If your file is longer than 3 hours, it will be divided into two orders and you should be able to see the new order ids in the content of this API call.

To get the results of your transcription orders, please use the following sample code:

import requests
import json

#order id to get content
given_order_id = 123456789
parameters = {
    "orderid" : given_order_id
}

url = "https://api.transkriptor.com/3/Get-Content"

#if the order is still in processing phase, send the following request again.
response = requests.get(url, params = parameters)

content = json.loads(response.content)

if "content" in content:
     print(content)
else:
     print("Still processing the order. Send the last request later again.")
const axios = require('axios');

const givenOrderId = 123456789;
const parameters = {
  orderid: givenOrderId
};

const url = 'https://api.transkriptor.com/3/Get-Content';

axios.get(url, { params: parameters })
  .then(response => {
    const content = response.data;
    if ('content' in content) {
      console.log(content);
    } else {
      console.log('Still processing the order. Send the last request later again.');
    }
  })
  .catch(error => {
    console.error(error);
  });

import java.io.IOException;
import java.net.URL;
import java.util.Map;
import com.fasterxml.jackson.databind.ObjectMapper;

public class Main {
    public static void main(String[] args) throws IOException {
        int givenOrderId = 123456789;
        String url = "https://api.transkriptor.com/3/Get-Content";
        ObjectMapper mapper = new ObjectMapper();

        URL requestUrl = new URL(url + "?orderid=" + givenOrderId);
        Map<String, Object> content = mapper.readValue(requestUrl, Map.class);

        if (content.containsKey("content")) {
            System.out.println(content);
        } else {
            System.out.println("Still processing the order. Send the last request later again.");
        }
    }
}

using System;
using System.Net;
using System.IO;
using System.Text;
using Newtonsoft.Json;

class Program
{
    static void Main()
    {
        int givenOrderId = 123456789;
        string url = $"https://api.transkriptor.com/3/Get-Content?orderid={givenOrderId}";

        using (WebClient client = new WebClient())
        {
            string response = client.DownloadString(url);
            dynamic content = JsonConvert.DeserializeObject(response);

            if (content["content"] != null)
            {
                Console.WriteLine(content);
            }
            else
            {
                Console.WriteLine("Still processing the order. Send the last request later again.");
            }
        }
    }
}

package main

import (
	"fmt"
	"encoding/json"
	"net/http"
	"io/ioutil"
)

type Response struct {
	Content map[string]interface{} `json:"content"`
}

func main() {
	givenOrderId := 123456789
	url := fmt.Sprintf("https://api.transkriptor.com/3/Get-Content?orderid=%d", givenOrderId)

	resp, err := http.Get(url)
	if err != nil {
		fmt.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	var data Response
	err = json.Unmarshal(body, &data)
	if err != nil {
		fmt.Println(err)
		return
	}

	if data.Content != nil {
		fmt.Println(data)
	} else {
		fmt.Println("Still processing the order. Send the last request later again.")
	}
}

require 'net/http'
require 'json'

given_order_id = 123456789
parameters = {
  "orderid" => given_order_id
}

url = URI.parse("https://api.transkriptor.com/3/Get-Content")
url.query = URI.encode_www_form(parameters)

response = Net::HTTP.get(url)
content = JSON.parse(response)

if content.key?("content")
  puts content
else
  puts "Still processing the order. Send the last request later again."
end

<?php
$given_order_id = 123456789;
$parameters = array(
    "orderid" => $given_order_id
);

$url = "https://api.transkriptor.com/3/Get-Content";

$response = file_get_contents($url . '?' . http_build_query($parameters));

$content = json_decode($response, true);

if (isset($content['content'])) {
    print_r($content);
} else {
    echo "Still processing the order. Send the last request later again.";
}
?>

import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import com.google.gson.Gson

data class Response(val content: Map<String, Any>?)

fun main() {
    val givenOrderId = 123456789
    val url = "https://api.transkriptor.com/3/Get-Content?orderid=$givenOrderId"

    val client = OkHttpClient()
    val request = Request.Builder()
        .url(url)
        .build()

    client.newCall(request).execute().use { response: Response ->
        val responseBody = response.body?.string()
        val gson = Gson()
        val data = gson.fromJson(responseBody, Response::class.java)

        if (data.content != null) {
            println(data)
        } else {
            println("Still processing the order. Send the last request later again.")
        }
    }
}

import Foundation

let givenOrderId = 123456789
let url = URL(string: "https://api.transkriptor.com/3/Get-Content?orderid=\(givenOrderId)")!

let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
    guard let data = data else {
        print("Error: \(error?.localizedDescription ?? "Unknown error")")
        return
    }
    
    do {
        let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
        if let content = json?["content"] {
            print(content)
        } else {
            print("Still processing the order. Send the last request later again.")
        }
    } catch {
        print("Error: \(error.localizedDescription)")
    }
}

task.resume()

import 'dart:convert';
import 'package:http/http.dart' as http;

void main() async {
  final givenOrderId = 123456789;
  final url = Uri.parse('https://api.transkriptor.com/3/Get-Content?orderid=$givenOrderId');

  final response = await http.get(url);

  if (response.statusCode == 200) {
    final content = jsonDecode(response.body);
    if (content.containsKey('content')) {
      print(content);
    } else {
      print('Still processing the order. Send the last request later again.');
    }
  } else {
    print('Error: ${response.statusCode}');
  }
}