Retrieving Order History

πŸ“š Get Order History API

Our Get Order History API provides you with a comprehensive view of your past transactions.

Using the following sample code, you can get the list of your previous orders:

import requests

url = "https://api.transkriptor.com/4/Get-History"

#your api key
parameters = {
    "apiKey" : "xxxxx"
}

resp = requests.get(url, params=parameters)

print(resp.status_code)
print(resp.text)
const axios = require('axios');

const url = 'https://api.transkriptor.com/4/Get-History';

const parameters = {
  apiKey: 'xxxxx'
};

axios.get(url, { params: parameters })
  .then(response => {
    console.log(response.status);
    console.log(response.data);
  })
  .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 {
        String url = "https://api.transkriptor.com/4/Get-History";
        Map<String, String> parameters = Map.of("apiKey", "xxxxx");

        URL requestUrl = new URL(url + "?" + encodeParams(parameters));
        String response = new String(requestUrl.openStream().readAllBytes());

        System.out.println("Response status code: " + http_response_code());
        System.out.println(response);
    }

    private static String encodeParams(Map<String, String> params) throws IOException {
        StringBuilder result = new StringBuilder();
        for (Map.Entry<String, String> entry : params.entrySet()) {
            if (result.length() > 0) {
                result.append("&");
            }
            result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
            result.append("=");
            result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
        }
        return result.toString();
    }
}

using System;
using System.Net;
using Newtonsoft.Json;

class Program
{
    static void Main()
    {
        string url = "https://api.transkriptor.com/4/Get-History";
        string apiKey = "xxxxx";

        using (WebClient client = new WebClient())
        {
            client.QueryString.Add("apiKey", apiKey);
            string response = client.DownloadString(url);

            Console.WriteLine(client.ResponseHeaders["status"]);
            Console.WriteLine(response);
        }
    }
}

package main

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

func main() {
	url := "https://api.transkriptor.com/4/Get-History"

	parameters := map[string]string{
		"apiKey": "xxxxx",
	}

	res, err := http.Get(url + "?" + encodeParams(parameters))
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

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

	fmt.Println(res.StatusCode)
	fmt.Println(string(body))
}

func encodeParams(params map[string]string) string {
	values := make([]string, 0, len(params))
	for key, value := range params {
		values = append(values, fmt.Sprintf("%s=%s", key, value))
	}
	return strings.Join(values, "&")
}

require 'net/http'
require 'json'

url = URI.parse('https://api.transkriptor.com/4/Get-History')
parameters = { 'apiKey' => 'xxxxx' }

url.query = URI.encode_www_form(parameters)

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

response = http.get(url)

puts response.code
puts response.body

<?php
$url = "https://api.transkriptor.com/4/Get-History";

$parameters = array(
    "apiKey" => "xxxxx"
);

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

echo http_response_code() . PHP_EOL;
echo $response;
?>

import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response

fun main() {
    val url = "https://api.transkriptor.com/4/Get-History"

    val parameters = mapOf(
        "apiKey" to "xxxxx"
    )

    val requestUrl = url + "?" + encodeParams(parameters)

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

    val response: Response = client.newCall(request).execute()
    println("Response status code: " + response.code())
    println(response.body()?.string())
}

fun encodeParams(params: Map<String, String>): String {
    val encodedParams = StringBuilder()
    params.forEach { (key, value) ->
        encodedParams.append(key).append("=").append(value).append("&")
    }
    return encodedParams.toString().dropLast(1)
}

import Foundation

let url = URL(string: "https://api.transkriptor.com/4/Get-History")!

let parameters = [
    "apiKey": "xxxxx"
]

let urlWithParams = url.appendingQueryParameters(parameters)
var request = URLRequest(url: urlWithParams)

let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
    if let error = error {
        print("Error: \(error.localizedDescription)")
        return
    }
    
    if let httpResponse = response as? HTTPURLResponse {
        print("Response status code: \(httpResponse.statusCode)")
    }
    
    if let data = data {
        if let str = String(data: data, encoding: .utf8) {
            print(str)
        }
    }
}

task.resume()

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

void main() async {
  final url = Uri.parse('https://api.transkriptor.com/4/Get-History');

  final parameters = {
    'apiKey': 'xxxxx',
  };

  final uri = Uri.parse(url.toString() + '?' + Uri(queryParameters: parameters).query);

  final response = await http.get(uri);

  print(response.statusCode);
  print(response.body);
}