Run

Marks a file for processing and can be called with a POST Request to the following URL:

[POST]  https://azure.leadtools.com/api/Run

Request Specific Parameters

Additional parameters available are listed below.

Parameter Description Accepted Values
id Unique identifier corresponding to an uploaded file. A valid GUID

Status Codes

The following status codes will be returned when the method is called:

Status Description
200 The file has been successfully marked for processing
400 The request was not valid for one of the following reasons:

• Required request parameters were not included.
• File information provided was malformed.
401 The AppID/Password combination is not valid, or does not correspond with the GUID provided.
500 There was an internal error processing your request.

Examples

JavaScript (Node.js)
C#
Python
PHP
Perl
//This sample uses the Request NodeJs library. 
const request = require('request'); 
 
var servicesUrl = "https://azure.leadtools.com/api/"; 
 
 
var RequestID = '00000000-0000-0000-0000-000000000000'; 
 
var runUrl = servicesUrl + 'Run?id='+ RequestID; 
request.post(getRequestOptions(runUrl), runCallback); 
 
function runCallback(error, response, body){ 
    if(!error && response.statusCode == 200){ 
        console.log("File has been successfully marked to run"); 
    }else{ 
        console.log("Run failed with HTTP code: " + response.statusCode); 
        console.log(body); 
    } 
} 
 
function getRequestOptions(url){ 
    //Function to generate and return HTTP request  options. 
    var requestOptions ={ 
        url: url, 
        headers: { 
            'Content-Length' : 0 
        }, 
        auth: { 
            user:"Enter Application ID", 
            password:"Enter Application Password" 
        } 
    }; 
    return requestOptions; 
} 
using System; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Threading; 
using System.Net; 
using System.Net.Http; 
using System.Net.Http.Headers; 
using Newtonsoft.Json.Linq; 
 
namespace Azure_Code_Snippets.DocumentationSnippets 
{ 
   class CloudServices_Run_Demo 
   { 
      private string hostedServicesUrl = "https://azure.leadtools.com/api/"; 
 
      public async void Run() 
      { 
         HttpClient client = InitClient(); 
         string id = Guid.Empty.ToString(); 
         string uploadUrl = string.Format("Run?id={0}", id); 
         var result = await client.PostAsync(uploadUrl, null); 
         if (result.StatusCode == HttpStatusCode.OK) 
         { 
            Console.WriteLine("File has been marked to run"); 
         } 
         else 
            Console.WriteLine("Request failed with the following response: " + result.StatusCode); 
      } 
 
 
      private HttpClient InitClient() 
      { 
         string AppId = "Enter Application ID"; 
         string Password = "Enter Application Password"; 
 
         HttpClient client = new HttpClient(); 
         client.BaseAddress = new Uri(hostedServicesUrl); 
         client.DefaultRequestHeaders.Accept.Clear(); 
         client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); 
 
         string authData = string.Format("{0}:{1}", AppId, Password); 
         string authHeaderValue = Convert.ToBase64String(Encoding.UTF8.GetBytes(authData)); 
         client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authHeaderValue); 
 
         return client; 
      } 
   } 
} 
#This sample uses the requests python library. 
 
import requests, sys, time 
 
servicesUrl = 'https://azure.leadtools.com/api/' 
 
requestID = '00000000-0000-0000-0000-000000000000'; 
 
#Your application ID. 
appId = "Enter Application ID"; 
 
#Your application password. 
password = "Enter Application Password"; 
 
baseRunUrl='{}Run?id={}' 
formattedRunUrl = baseRunUrl.format(servicesUrl, requestID) 
request = requests.post(formattedRunUrl, auth=(appId, password)) 
if request.status_code != 200: 
    print("Error sending the conversion request") 
    print(request.text) 
    sys.exit() 
 
print("File has successfully been marked to run") 
<?php 
 
    $servicesBaseUrl = "https://azure.leadtools.com/api/"; 
 
    $requestID = '00000000-0000-0000-0000-000000000000'; 
 
    $runUrl = "%sRun?id=%s"; 
    $runUrl = sprintf($runUrl, $servicesBaseUrl, $requestID); 
    $requestOptions = GeneratePostOptions($runUrl); 
 
    $request = curl_init(); 
    curl_setopt_array($request, $requestOptions); 
    if(!$response = curl_exec($request)) //Make sure that the request was successful 
    { 
        if(curl_errno($request)){ 
            echo "There was an error queueing the request \n\r"; 
            echo curl_error($request); 
            curl_close($request); 
            return false; 
        } 
    } 
    curl_close($request); 
 
    echo "$response \n"; 
 
 
    function GeneratePostOptions($url) 
    { 
        $appId = "Enter Application ID"; 
        $password = "Enter Application Password"; 
 
        $headers = array( 
            "Content-Length : 0" 
            ); 
        $postOptions = array( 
            CURLOPT_POST => 1, 
            CURLOPT_URL => $url, 
            CURLOPT_FRESH_CONNECT => 1, 
            CURLOPT_RETURNTRANSFER => 1, 
            CURLOPT_USERPWD => "$appId:$password", 
            CURLOPT_FORBID_REUSE => 1, 
            CURLOPT_HTTPHEADER => $headers 
        ); 
        return $postOptions; 
    } 
 
?> 
use base 'HTTP::Message'; 
use LWP::UserAgent (); 
 
my $servicesUrl = "https://azure.leadtools.com/api/"; 
 
my $requestID = '00000000-0000-0000-0000-000000000000'; 
 
my $appId = 'Enter Application ID'; 
my $password = 'Enter Application Password'; 
my $headers = HTTP::Headers->new( 
    Content_Length => 0 
); 
$headers->authorization_basic($appId, $password); 
 
#The User Agent to be used when making requests 
my $ua = LWP::UserAgent->new; 
 
my $runUrl = $servicesUrl . 'Run?id=' . $requestID; 
my $request = HTTP::Request->new(POST => $runUrl, $headers); 
my $response = $ua->request($request); 
if(!$response->is_success){ 
    print STDERR $response->status_line, "\n"; 
    exit; 
} 

See Also

Resources

Legal

Help Version 21.0.2021.9.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.