API Documentation.
This page provides a comprehensive guide on how to connect your application to our API using various programming languages. Whether you're developing in Python, JavaScript, PHP, C#, Ruby, Java, or Swift, we've got you covered. Each section below includes detailed examples showcasing the necessary steps to integrate your application with our API, enabling seamless data exchange and unlocking powerful features. Before proceeding, please ensure that you have the necessary permissions and access credentials for our API. Explore the corresponding sections, and choose the one that best suits your development environment and language preference. Let's get started on harnessing the power of our platform to drive your application's performance to new heights!
Integration with our Parsing API using .net core C# code example
static string _customerId = "2dab44fd-0000-0x0x-xxxx-9f252f7b6943"; //Your registered CustomerID static string _secretKey = "7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5"; //Your registered SecretKey static void Main(string[] args) { string resumeFilePath = "C:\\Resumes\\5.doc"; //Location of the resume file string customerId = _customerId; string secretKey = _secretKey; SendResumeAsync(resumeFilePath, customerId, secretKey).GetAwaiter().GetResult(); } public static async Task SendResumeAsync(string resumeFilePath, string customerId, string secretKey) { using (var httpClient = new HttpClient()) { httpClient.Timeout = TimeSpan.FromMinutes(5); // Set the timeout to 5 minutes using (var content = new MultipartFormDataContent()) { using (var fileStream = File.OpenRead(resumeFilePath)) { try { content.Add(new StreamContent(fileStream), "file", Path.GetFileName(resumeFilePath)); // Add CustomerID and SecretKey to the request content.Add(new StringContent(customerId), "CustomerID"); content.Add(new StringContent(secretKey), "SecretKey"); var response = await httpClient.PostAsync("https://bhdresumeparser.azurewebsites.net/Resume/ParseResume", content); var jsonResponse = await response.Content.ReadAsStringAsync(); // Print the JSON response Console.WriteLine("JSON response: " + jsonResponse); // Parse the JSON response into a JObject if (jsonResponse.Trim().StartsWith("{")) { // Parse the JSON response into a JObject var jsonObject = JObject.Parse(jsonResponse); // Access the properties of the JSON object foreach (var property in jsonObject.Properties()) { Console.WriteLine($"{property.Name}: {property.Value}"); } } else { Console.WriteLine($"Error: {jsonResponse}"); } Console.Read(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.Read(); } } } } }
Use the following code to connect to our Resume Parsing API using PHP
<?php require 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; $customerId = "2dab44fd-0000-0x0x-xxxx-9f252f7b6943"; //Your registered CustomerID $secretKey = "7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5"; //Your registered SecretKey $resumeFilePath = "C:\\Resumes\\5.doc"; //Location of the resume file try { $client = new Client(['timeout' => 300]); // Set the timeout to 5 minutes $multipart = [ [ 'name' => 'file', 'contents' => fopen($resumeFilePath, 'r'), 'filename' => basename($resumeFilePath) ], [ 'name' => 'CustomerID', 'contents' => $customerId ], [ 'name' => 'SecretKey', 'contents' => $secretKey ] ]; $response = $client->request('POST', 'https://bhdresumeparser.azurewebsites.net/Resume/ParseResume', [ 'multipart' => $multipart ]); $jsonResponse = (string)$response->getBody(); // Print the JSON response echo "JSON response: " . $jsonResponse; if (trim($jsonResponse)[0] === '{') { // Parse the JSON response into an associative array $jsonObject = json_decode($jsonResponse, true); // Access the properties of the associative array foreach ($jsonObject as $property => $value) { echo $property . ": " . $value; } } else { echo "Error: " . $jsonResponse; } } catch (RequestException $ex) { echo $ex->getMessage(); }
Use the following code to connect to our Resume Parsing API using Javascript
const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const customerId = '2dab44fd-0000-0x0x-xxxx-9f252f7b6943'; // Your registered CustomerID const secretKey = '7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5'; // Your registered SecretKey const resumeFilePath = 'C:\\Resumes\\5.doc'; // Location of the resume file const form = new FormData(); form.append('file', fs.createReadStream(resumeFilePath)); form.append('CustomerID', customerId); form.append('SecretKey', secretKey); axios.post('https://bhdresumeparser.azurewebsites.net/Resume/ParseResume', form, { headers: form.getHeaders(), timeout: 300000, // 5 minutes }).then(response => { const jsonResponse = response.data; // Print the JSON response console.log('JSON response: ', jsonResponse); if (typeof jsonResponse === 'object') { // Access the properties of the JSON object for (const property in jsonResponse) { console.log(`${property}: ${jsonResponse[property]}`); } } else { console.log(`Error: ${jsonResponse}`); } }).catch(error => { console.error(error.message); });
To run this code, you need to have Node.js installed and the "axios" and "form-data" libraries. You can install these libraries with npm (Node Package Manager) using the following commands:
npm install axios
npm install form-data
Use the following code to connect to our Resume Parsing API using Python
import requests import json customerId = '2dab44fd-0000-0x0x-xxxx-9f252f7b6943' # Your registered CustomerID secretKey = '7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5' # Your registered SecretKey resumeFilePath = 'C:\\Resumes\\5.doc' # Location of the resume file url = 'https://bhdresumeparser.azurewebsites.net/Resume/ParseResume' with open(resumeFilePath, 'rb') as f: files = {'file': (f.name, f)} data = {'CustomerID': customerId, 'SecretKey': secretKey} try: response = requests.post(url, files=files, data=data, timeout=300) jsonResponse = response.json() # Print the JSON response print('JSON response: ', jsonResponse) if isinstance(jsonResponse, dict): # Access the properties of the JSON object for property, value in jsonResponse.items(): print(f'{property}: {value}') else: print(f'Error: {jsonResponse}') except requests.exceptions.RequestException as e: print(e)
This script sends a POST request with the resume file, CustomerID, and SecretKey to the specified URL, then prints the response to the console.
Please make sure that you have the requests library installed. If you don't, you can install it with pip:
pip install requests
Use the following code to connect to our Resume Parsing API using Ruby
require 'net/http' require 'uri' require 'json' customerId = '2dab44fd-0000-0x0x-xxxx-9f252f7b6943' # Your registered CustomerID secretKey = '7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5' # Your registered SecretKey resumeFilePath = 'C:\\Resumes\\5.doc' # Location of the resume file uri = URI.parse('https://bhdresumeparser.azurewebsites.net/Resume/ParseResume') request = Net::HTTP::Post.new(uri) request.content_type = 'multipart/form-data' request.body = JSON.dump({ 'file' => File.open(resumeFilePath, 'rb'), 'CustomerID' => customerId, 'SecretKey' => secretKey }) req_options = { use_ssl: uri.scheme == 'https', open_timeout: 300, # 5 minutes } begin response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http| http.request(request) end jsonResponse = JSON.parse(response.body) # Print the JSON response puts 'JSON response: ', jsonResponse if jsonResponse.is_a?(Hash) # Access the properties of the JSON object jsonResponse.each do |property, value| puts "#{property}: #{value}" end else puts "Error: #{jsonResponse}" end rescue Net::OpenTimeout => e puts e.message end
Use the following code to connect to our Resume Parsing API using Java
import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import org.json.JSONObject; import java.io.File; import java.io.IOException; public class Main { private static final String customerId = "2dab44fd-0000-0x0x-xxxx-9f252f7b6943"; // Your registered CustomerID private static final String secretKey = "7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5"; // Your registered SecretKey private static final String resumeFilePath = "C:\\Resumes\\5.doc"; // Location of the resume file public static void main(String[] args) throws IOException { try (CloseableHttpClient httpclient = HttpClients.createDefault()) { HttpPost httpPost = new HttpPost("https://bhdresumeparser.azurewebsites.net/Resume/ParseResume"); File file = new File(resumeFilePath); HttpEntity reqEntity = MultipartEntityBuilder.create() .addBinaryBody("file", file, ContentType.DEFAULT_BINARY, file.getName()) .addTextBody("CustomerID", customerId) .addTextBody("SecretKey", secretKey) .build(); httpPost.setEntity(reqEntity); HttpResponse response = httpclient.execute(httpPost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { String jsonResponse = EntityUtils.toString(resEntity); // Print the JSON response System.out.println("JSON response: " + jsonResponse); JSONObject jsonObject = new JSONObject(jsonResponse); // Access the properties of the JSON object jsonObject.keys().forEachRemaining(key -> { Object value = jsonObject.get(key); System.out.println(key + ": " + value); }); } } catch (Exception e) { e.printStackTrace(); } } }
Here’s how to add these dependencies with Maven:
<dependencies> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.13</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>4.5.13</version> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20210307</version> </dependency> </dependencies>
Use the following code to connect to our Resume Parsing API using Swift
Here's how you might implement this in Swift using URLSession for networking and Alamofire for multipart form data encoding:
Firstly, you have to install Alamofire. If you're using Swift Package Manager, you can add the package dependency in Xcode by going to File > Swift Packages > Add Package Dependency, and then input the Alamofire repository URL (https://github.com/Alamofire/Alamofire.git).
import Alamofire let customerId = "2dab44fd-0000-0x0x-xxxx-9f252f7b6943" // Your registered CustomerID let secretKey = "7aa82ae4-xxxx-0000-xxxx-ac1439ea02a5" // Your registered SecretKey let resumeFilePath = "/path/to/your/resume.doc" // Location of the resume file let url = "https://bhdresumeparser.azurewebsites.net/Resume/ParseResume" let headers: HTTPHeaders = [ .contentType("multipart/form-data") ] let fileURL = URL(fileURLWithPath: resumeFilePath) AF.upload(multipartFormData: { multipartFormData in multipartFormData.append(fileURL, withName: "file") multipartFormData.append(Data(customerId.utf8), withName: "CustomerID") multipartFormData.append(Data(secretKey.utf8), withName: "SecretKey") }, to: url, method: .post, headers: headers) .responseJSON { response in switch response.result { case .success(let json): print("JSON response: \(json)") if let jsonResponse = json as? [String: Any] { for (key, value) in jsonResponse { print("\(key): \(value)") } } else { print("Error: \(json)") } case .failure(let error): print(error) } }
Note that network requests should not be executed on the main thread. This code should be executed in the background. Also, the Alamofire .responseJSON
closure is not called on the main thread, so if you want to do any UI updates based on the response, you'll need to dispatch those back to the main thread.