API Guide for Business Customers

*REST API Generating audio to the articles in your website:

Functions to use

1) Create voice for an article , non-Blocking function, (Fire-and-Forget)

void CreateVoiceArticleNonBlock(string BusinessName, string SubscriptionID, string urlArticle, string xmlString, string languageCode, string nameVoice, double speed, double pitch, string category)

Replace parameters with:

BusinessName=<Your company name>
SubscriptionID= <subscription key >
urlArticle= <url of article>
xmlString= string (textOfTitle + " . " +textOfBrief+" . "+textOfBody) // put " . " between texts sections
languageCode="he-IL"
nameVoice="he-IL-AvriNeural"
speed="1"
pitch="1"
category = <second category> secondary category of the article like: news, health, politics

2) Delete a voice of an article ( in case of edit the content of the article)

ReturnVal DeleteVoiceArticle(string BusinessName, string SubscriptionID, string urlArticle)

3) Check if voice was created in the system:

bool VoiceIsExist(string BusinessName, string SubscriptionID, string urlArticle)

Examples code

in C#


PostRest().Wait(); // In wrapper function
public static async Task GenerateAudio()
{
  string apiUrl = "https://colbass.com/api/CreateVoiceArticleNonBlock";
  string url = "https://website_name/article/1";
  ApiCreateParametersObj requestData = new ApiCreateParametersObj
  {
    BusinessName = "website_name",
    SubscriptionID = "I-AAAAAAA",
    urlArticle = url,
    xmlString = "hello world",
    languageCode = "en-US",
    nameVoice = "en-US-Wavenet-B",
    speed = 1,
    pitch = 1,
    category = "news"
  };
  string jsonData = JsonConvert.SerializeObject(requestData, Formatting.Indented);
  using (HttpClient client = new HttpClient())
  {
    StringContent content = new StringContent(jsonData, Encoding.UTF8, "application/json");
    try
    {
      HttpResponseMessage postTask = await client.PostAsync(apiUrl, content);
    }
    catch (Exception ex)
    {
      Console.WriteLine($"Exception: {ex.Message}");
    }
  }
}

in PHP

  $apiUrl = 'https://colbass.com/api/CreateVoiceArticleNonBlock';
  $url='http://ExampleColbassHeb/article/1.html';
  $data = array(
    'BusinessName' => "website_name",
    'SubscriptionID' => "I-AAAAAAA",
    'urlArticle' => $url,
    'xmlString' => "Hello World",
    'languageCode' => "en-US",
    'nameVoice' => "en-US-Wavenet-B",
    'speed' => 1,
    'pitch' => 1,
    'category' => "News"
  );
  $ch = curl_init($apiUrl);
  $data = json_encode($data);
  // Set cURL options
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return the response as a string instead of outputting it
  curl_setopt($ch, CURLOPT_POST, true); // Set the request type to POST
  curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // Set the POST data
  curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Content-Type: application/json',
  ));
  curl_exec($ch);
  curl_close($ch);