Registering a Webhook

📡 Register a Webhook

You can register a webhook to get notified when a transcriptions is ready.

import requests

url = "https://api.transkriptor.com/10/Register-Webhook"

#your api key
parameters = {
    "apiKey" : "xxxxx",
    "url":"www.example.com/api/test"
}

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

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

const url = "https://api.transkriptor.com/10/Register-Webhook";
const parameters = {
    apiKey: "xxxxx",
    url: "www.example.com/api/test"
};

axios.get(url, { params: parameters })
    .then(response => {
        console.log(response.status);
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });

import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Main {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        HttpUrl url = new HttpUrl.Builder()
            .scheme("https")
            .host("api.transkriptor.com")
            .addPathSegment("10")
            .addPathSegment("Register-Webhook")
            .addQueryParameter("apiKey", "xxxxx")
            .addQueryParameter("url", "www.example.com/api/test")
            .build();

        Request request = new Request.Builder().url(url).build();

        try (Response response = client.newCall(request).execute()) {
            System.out.println(response.code());
            System.out.println(response.body().string());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program {
    static async Task Main() {
        using (HttpClient client = new HttpClient()) {
            var url = "https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test";
            HttpResponseMessage response = await client.GetAsync(url);
            Console.WriteLine((int)response.StatusCode);
            Console.WriteLine(await response.Content.ReadAsStringAsync());
        }

package main

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

func main() {
    url := "https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test"

    resp, err := http.Get(url)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

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

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

require 'net/http'
require 'uri'

uri = URI("https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test")
response = Net::HTTP.get_response(uri)

puts response.code
puts response.body

<?php
$url = "https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test";

$response = file_get_contents($url);
$httpCode = http_response_code();

echo $httpCode . "\n";
echo $response;
?>

import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request

fun main() {
    val client = OkHttpClient()

    val url = HttpUrl.Builder()
        .scheme("https")
        .host("api.transkriptor.com")
        .addPathSegment("10")
        .addPathSegment("Register-Webhook")
        .addQueryParameter("apiKey", "xxxxx")
        .addQueryParameter("url", "www.example.com/api/test")
        .build()

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

    client.newCall(request).execute().use { response ->
        println(response.code)
        println(response.body?.string())
    }
}

import Foundation

let urlString = "https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test"
let url = URL(string: urlString)!

let task = URLSession.shared.dataTask(with: url) { (data, response, error) in
    if let httpResponse = response as? HTTPURLResponse {
        print(httpResponse.statusCode)
    }

    if let receivedData = data {
        print(String(data: receivedData, encoding: .utf8) ?? "")
    }
}
task.resume()

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

void main() async {
  final url = Uri.parse("https://api.transkriptor.com/10/Register-Webhook?apiKey=xxxxx&url=www.example.com/api/test");
  final response = await http.get(url);

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