AI Scoring API: File Status

The scoring filestatus API returns the file processing status for the file been submitted using sendfile API. Please refer to the C# example for details.

POST /V2/SCORING/FILESTATUS

API URL: https://bulkapi.zerobounce.net/v2/scoring/filestatus

URL Parameters

  • Parameter
    Required/Optional
    Description
  • api_key
    Required
    Your API Key, found in your account
  • file_id
    Required
    The returned file ID when calling scoring sendfile API

If you want to call the API from your browser to test it, all you have to do is to replace the API KEY with your key and the FILE ID with the returned file ID from scoring sendfile

Send File Code Samples

  • Visual Basic
  • C#
  • PHP
  • Java
  • Python
  • Swift
  • Objective C
  • Android Java
      
' File Status Sample in VB.net

Public Class FileStatus
   Public Property success As Boolean
   Public Property file_id As String
   Public Property file_name As String
   Public Property upload_date As String
   Public Property file_status As String
   Public Property complete_percentage As String
   Public Property return_url As String
End Class

Private Shared Sub FileStatusAPITest()
   Dim apiKey As String = "replace with your api key here"
   Dim fileID As String = "replace with the returned file ID when calling sendfile API"

   Try
       Dim fileStatus As FileStatus = FileStatusAsync(apiKey, fileID).Result
       Console.Write(JsonConvert.SerializeObject(fileStatus, Formatting.Indented))
   Catch ex As Exception
       Console.Write(ex.InnerException.Message)
   End Try

   Console.ReadKey()
End Sub

Public Shared Async Function FileStatusAsync(ByVal apiKey As String, ByVal fileID As String) As Task(Of FileStatus)
   If String.IsNullOrEmpty(apiKey) Then Throw New Exception("Error: apiKey is required")
   If String.IsNullOrEmpty(fileID) Then Throw New Exception("Error: fileID is required")
   Dim uri As Uri = New Uri($"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key={apiKey}&file_id={fileID}")

   Using client = New HttpClient()
       Using request = New HttpRequestMessage(HttpMethod.Get, uri)
           Using response = Await client.SendAsync(request).ConfigureAwait(False)
               Dim content = Await response.Content.ReadAsStringAsync()

               If response.IsSuccessStatusCode = False Then
                   Dim error As String = $"StatusCode = {CInt(response.StatusCode)}, Content = {content}"
                   Throw New Exception(error)
               End If

               Return JsonConvert.DeserializeObject(Of FileStatus)(content)
           End Using
       End Using
   End Using
End Function
   

// File Status Sample in C#

public class FileStatus
{
   public bool success { get; set; }
   public string file_id { get; set; }
   public string file_name { get; set; }
   public string upload_date { get; set; }
   public string file_status { get; set; }
   public string complete_percentage { get; set; }
   public string return_url { get; set; }
}

private static void FileStatusAPITest()
{
   string apiKey = "replace with your api key here";
   string fileID = "replace with the returned file ID when calling sendfile API";

   try
   {
       FileStatus fileStatus = FileStatusAsync(apiKey, fileID).Result;
       Console.Write(JsonConvert.SerializeObject(fileStatus, Formatting.Indented));
   }
   catch (Exception ex)
   {
       Console.Write(ex.InnerException.Message);
   }
   Console.ReadKey();
}

public static async Task<FileStatus> FileStatusAsync(string apiKey, string fileID)
{
   if (string.IsNullOrEmpty(apiKey))
       throw new Exception("Error: apiKey is required");
   if (string.IsNullOrEmpty(fileID))
       throw new Exception("Error: fileID is required");

   Uri uri = new Uri($"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key={apiKey}&file_id={fileID}");

   using (var client = new HttpClient())
   using (var request = new HttpRequestMessage(HttpMethod.Get, uri))
   using (var response = await client.SendAsync(request).ConfigureAwait(false))
   {
       var content = await response.Content.ReadAsStringAsync();

       if (response.IsSuccessStatusCode == false)
       {
           var error = $"StatusCode = {(int)response.StatusCode}, Content = {content}";
           throw new Exception(error);
       }

       return JsonConvert.DeserializeObject<FileStatus>(content);
   }
}
   

   <?php

   $curl = curl_init();
   
   curl_setopt_array($curl, array(
     CURLOPT_URL => "https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours",
     CURLOPT_RETURNTRANSFER => true,
     CURLOPT_ENCODING => "",
     CURLOPT_MAXREDIRS => 10,
     CURLOPT_TIMEOUT => 30,
     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
     CURLOPT_CUSTOMREQUEST => "GET",
     CURLOPT_POSTFIELDS => "",
     CURLOPT_HTTPHEADER => array(
       "Postman-Token: 91504cea-f92f-46b0-97a4-338167072887",
       "cache-control: no-cache"
     ),
   ));
   
   $response = curl_exec($curl);
   $err = curl_error($curl);
   
   curl_close($curl);
   
   if ($err) {
     echo "cURL Error #:" . $err;
   } else {
     echo $response;
   }
   ?>
   

   OkHttpClient client = new OkHttpClient();

   Request request = new Request.Builder()
     .url("https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours")
     .get()
     .addHeader("cache-control", "no-cache")
     .addHeader("Postman-Token", "7fffd7a4-b2fd-4e8b-ac85-4099411f27ce")
     .build();
   
   Response response = client.newCall(request).execute();
   

   import http.client

   conn = http.client.HTTPConnection("bulkapi,zerobounce,net")
   
   payload = ""
   
   headers = {
       'cache-control': "no-cache",
       'Postman-Token': "caa917fe-45ce-45ae-9456-2b039b999dcb"
       }
   
   conn.request("GET", "v2,filestatus", payload, headers)
   
   res = conn.getresponse()
   data = res.read()
   
   print(data.decode("utf-8"))
   
   

   // Please select VB or C# language for File Status Sampleimport Foundation

   let headers = [
     "cache-control": "no-cache",
     "Postman-Token": "4f1b92e2-034f-4fa0-94d9-b097d768668a"
   ]
   
   let request = NSMutableURLRequest(url: NSURL(string: "https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours")! as URL,
                                           cachePolicy: .useProtocolCachePolicy,
                                       timeoutInterval: 10.0)
   request.httpMethod = "GET"
   request.allHTTPHeaderFields = headers
   
   let session = URLSession.shared
   let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
     if (error != nil) {
       print(error)
     } else {
       let httpResponse = response as? HTTPURLResponse
       print(httpResponse)
     }
   })
   
   dataTask.resume()
   

   #import <Foundation/Foundation.h>

   NSDictionary *headers = @{ @"cache-control": @"no-cache",
                              @"Postman-Token": @"5e9c24ae-b577-4e33-8748-83f14e151ae9" };
   
   NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://bulkapi.zerobounce.net/v2/scoring/filestatus?api_key=replacewithyours&file_id=replacewithyours"]
                                                          cachePolicy:NSURLRequestUseProtocolCachePolicy
                                                      timeoutInterval:10.0];
   [request setHTTPMethod:@"GET"];
   [request setAllHTTPHeaderFields:headers];
   
   NSURLSession *session = [NSURLSession sharedSession];
   NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
                                               completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                   if (error) {
                                                       NSLog(@"%@", error);
                                                   } else {
                                                       NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
                                                       NSLog(@"%@", httpResponse);
                                                   }
                                               }];
   [dataTask resume];
   

// N/A
   

Endpoint Response

Successful Response

      
{
 "success": true,
 "file_id": "aaaaaaaa-zzzz-xxxx-yyyy-5003727fffff",
 "file_name": "Your file name.csv",
 "upload_date": "10/20/2018 4:35:58 PM",
 "file_status": "Complete",
 "complete_percentage": "100%",
 "return_url": "Your return URL if provided when calling sendfile API"
}
   

Error Response


   {      
     "success": false,
     "message": "Error messages"
   }