Sample Code

This topic gives Resume Redactor API code samples to get you start quickly.

Sample Code - Java

OOkHttpClient client = new OkHttpClient().newBuilder().build();
		MediaType mediaType = MediaType.parse("application/json");
		RequestBody body = RequestBody.create(mediaType, "{\r\n"
				+ "  \"filedata\": \"File data in base64\",\r\n"
				+ "  \"userkey\": \"Your API UserKey\",\r\n"
				+ "  \"version\": \"1.0.0\",\r\n"
				+ "  \"subuserid\": \"Your Company Name\",\r\n"
				+ "  \"filename\": \"Resume file name\",\r\n"
				+ "  \"jsondata\": \"Resume Parser API Json output in base64\",\r\n"
				+ "  \"configuration\": {\r\n"
				+ "        \"maskfields\": [\r\n"
				+ "            \"Name\",\r\n"
				+ "            \"DateOfBirth\",\r\n"
				+ "            \"MaritalStatus\",\r\n"
				+ "            \"Gender\",\r\n"
				+ "            \"Email\",\r\n"
				+ "            \"PhoneNumber\",\r\n"
				+ "            \"WebSite\",\r\n"
				+ "            \"Address\",\r\n"
				+ "            \"Nationality\",\r\n"
				+ "            \"PassportNumber\",\r\n"
				+ "            \"CurrentSalary\",\r\n"
				+ "            \"LanguageKnown\",\r\n"
				+ "            \"Employer.Name\",\r\n"
				+ "            \"Employer.JobProfile\",\r\n"
				+ "            \"Employer.City\",\r\n"
				+ "            \"Employer.State\",\r\n"
				+ "            \"Employer.Country\",\r\n"
				+ "            \"Institution.Name\",\r\n"
				+ "            \"References\",\r\n"
				+ "            \"CandidateImage\"\r\n"
				+ "        ],\r\n"
				+ "        \"masktype\": \"x-value\",\r\n"
				+ "        \"highlightcolor\": \"\",\r\n"
				+ "        \"abbreviationfields\": [\r\n"
				+ "            \"Name\",\r\n"
				+ "            \"Email\",\r\n"
				+ "        ],\r\n"
				+ "        \"abbreviation\": true\r\n"
				+ "    }\r\n"
				+ "}");
		Request request = new Request.Builder()
		  .url("https://redact.rchilli.com/RedactAPI/Rchilli/redactResume")
		  .method("POST", body)
		  .addHeader("Content-Type", "application/json")
		  .build();
		Response response = client.newCall(request).execute(); 

Sample Code - Python

import http.client
import json

conn = http.client.HTTPSConnection("redact.rchilli.com")
payload = json.dumps({
  "filedata": "File data in base64",
  "userkey": "Your API UserKey",
  "version": "1.0.0",
  "subuserid": "Your Company Name",
  "filename": "Resume file name",
  "jsondata": "Resume Parser API Json output in base64",
  "configuration": {
	  "maskfields": [
		"Name",
		"DateOfBirth",
		"MaritalStatus",
		"Gender",
		"Email",
		"PhoneNumber",
		"WebSite",
		"Address",
		"Nationality",
		"PassportNumber",
		"CurrentSalary",
		"LanguageKnown",
		"Employer.Name",
		"Employer.JobPeriod",
		"Employer.City",
		"Employer.State",
		"Employer.Country",
		"Institution.Name",
		"References",
		"CandidateImage"
	  ],
	  "masktype": "x-value",
	  "highlightcolor": "",
	  "abbreviationfields": [
		"Name",
		"Email"
	  ],
	  "abbreviation": true
	}
}
)
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/RedactAPI/Rchilli/redactResume", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Sample Code - PHP

<?php>
$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://redact.rchilli.com/RedactAPI/Rchilli/redactResume',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "filedata": "File data in base64",
  "userkey": "Your API UserKey",
  "version": "1.0.0",
  "subuserid": "Your Company Name",
  "filename": "Resume file name",
  "jsondata": "Resume Parser API Json output in base64",
  "configuration": {
	  "maskfields": [
		"Name",
		"DateOfBirth",
		"MaritalStatus",
		"Gender",
		"Email",
		"PhoneNumber",
		"WebSite",
		"Address",
		"Nationality",
		"PassportNumber",
		"CurrentSalary",
		"LanguageKnown",
		"Employer.Name",
		"Employer.JobPeriod",
		"Employer.City",
		"Employer.State",
		"Employer.Country",
		"Institution.Name",
		"References",
		"CandidateImage"
	  ],
	  "masktype": "x-value",
	  "highlightcolor": "",
	  "abbreviationfields": [
		"Name",
		"Email"
	  ],
	  "abbreviation": true
	}
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;cho 'Error: ' . $e->getMessage();
}										

Sample Code - NodeJS

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'POST',
  'hostname': 'redact.rchilli.com',
  'path': '/RedactAPI/Rchilli/redactResume',
  'headers': {
    'Content-Type': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = JSON.stringify({
  "filedata": "File data in base64",
  "userkey": "Your API UserKey",
  "version": "1.0.0",
  "subuserid": "Your Company Name",
  "filename": "Resume file name",
  "jsondata": "Resume Parser API Json output in base64",
  "configuration": {
	  "maskfields": [
		"Name",
		"DateOfBirth",
		"MaritalStatus",
		"Gender",
		"Email",
		"PhoneNumber",
		"WebSite",
		"Address",
		"Nationality",
		"PassportNumber",
		"CurrentSalary",
		"LanguageKnown",
		"Employer.Name",
		"Employer.JobPeriod",
		"Employer.City",
		"Employer.State",
		"Employer.Country",
		"Institution.Name",
		"References",
		"CandidateImage"
	  ],
	  "masktype": "x-value",
	  "highlightcolor": "",
	  "abbreviationfields": [
		"Name",
		"Email"
	  ],
	  "abbreviation": true
	}
});

req.write(postData);

req.end();

Sample Code - Ruby

require "uri"
require "json"
require "net/http"

url = URI("https://redact.rchilli.com/RedactAPI/Rchilli/redactResume")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "filedata": "File data in base64",
  "userkey": "Your API UserKey",
  "version": "1.0.0",
  "subuserid": "Your Company Name",
  "filename": "Resume file name",
  "jsondata": "Resume Parser API Json output in base64",
  "configuration": {
	  "maskfields": [
		"Name",
		"DateOfBirth",
		"MaritalStatus",
		"Gender",
		"Email",
		"PhoneNumber",
		"WebSite",
		"Address",
		"Nationality",
		"PassportNumber",
		"CurrentSalary",
		"LanguageKnown",
		"Employer.Name",
		"Employer.JobPeriod",
		"Employer.City",
		"Employer.State",
		"Employer.Country",
		"Institution.Name",
		"References",
		"CandidateImage"
	  ],
	  "masktype": "x-value",
	  "highlightcolor": "",
	  "abbreviationfields": [
		"Name",
		"Email"
	  ],
	  "abbreviation": true
	}
})

response = https.request(request)
puts response.read_body

Sample Code - C#

var client = new RestClient("https://redact.rchilli.com/RedactAPI/Rchilli/redactResume");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var body = @"{
  ""filedata"": ""File data in base64"",
  ""userkey"": ""Your API UserKey"",
  ""version"": ""1.0.0"",
  ""subuserid"": ""Your Company Name"",
  ""filename"": ""Resume file name"",
  ""jsondata"": ""Resume Parser API Json output in base64"",
  ""configuration"": {
	  ""maskfields"": [
		""Name"",
		""DateOfBirth"",
		""MaritalStatus"",
		""Gender"",
		""Email"",
		""PhoneNumber"",
		""WebSite"",
		""Address"",
		""Nationality"",
		""PassportNumber"",
		""CurrentSalary"",
		""LanguageKnown"",
		""Employer.Name"",
		""Employer.JobPeriod"",
		""Employer.City"",
		""Employer.State"",
		""Employer.Country"",
		""Institution.Name"",
		""References"",
		""CandidateImage""
	  ],
	  ""masktype"": ""x-value"",
	  ""highlightcolor"": """",
	  ""abbreviationfields"": [
		""Name"",
		""Email""
	  ],
	  ""abbreviation"": true
	}
}
" + "\n" +
@"";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);		

Sample Code - cURL

curl --location --request POST 'https://redact.rchilli.com/RedactAPI/Rchilli/redactResume' \
--header 'Content-Type: application/json' \
--data-raw '{
  "filedata": "File data in base64",
  "userkey": "Your API UserKey",
  "version": "1.0.0",
  "subuserid": "Your Company Name",
  "filename": "Resume file name",
  "jsondata": "Resume Parser API Json output in base64",
  "configuration": {
	  "maskfields": [
		"Name",
		"DateOfBirth",
		"MaritalStatus",
		"Gender",
		"Email",
		"PhoneNumber",
		"WebSite",
		"Address",
		"Nationality",
		"PassportNumber",
		"CurrentSalary",
		"LanguageKnown",
		"Employer.Name",
		"Employer.JobPeriod",
		"Employer.City",
		"Employer.State",
		"Employer.Country",
		"Institution.Name",		
		"References",
		"CandidateImage"
	  ],
	  "masktype": "x-value",
	  "highlightcolor": "",
	  "abbreviationfields": [
		"Name",
		"Email"
	  ],
	  "abbreviation": true
	}
}'