Sample Codes

This topic gives Skill Gap Detection API plugin code samples to get you start quickly.

Sample Code - Java

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "\r\n{\r\n    \"userkey\": \"Use Your userkey\",\r\n    \"subuserid\" : \"SubUser\",\r\n    \"filename\": \"SampleDocument-sg.docx\",\r\n    \"filedata\": \"{{base64data}}\",\r\n}");
Request request = new Request.Builder()
  .url("https://plugin.rchilli.com/RChilliPlugin/rchilli/skillGapDetection")
  .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("plugin.rchilli.com")
payload = json.dumps({
  "userkey": "Use your userkey",
  "subuserid": "SubUser",
  "filename": "SampleDocument-sg.docx",
  "filedata": "{{base64data}}",
})
headers = {
  'Content-Type': 'application/json'
}
conn.request("POST", "/RChilliPlugin/rchilli/skillGapDetection", 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://plugin.rchilli.com/RChilliPlugin/rchilli/skillGapDetection',
  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 =>'
{
    "userkey": "Use Your userkey",
    "subuserid" : "SubUser",
    "filename": "SampleDocument-sg.docx",
    "filedata": "{{base64data}}",
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Sample Code - NodeJS

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

var options = {
  'method': 'POST',
  'hostname': 'plugin.rchilli.com',
  'path': '/RChilliPlugin/rchilli/skillGapDetection',
  '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({
  "userkey": "Use Your userkey",
  "subuserid": "SubUser",
  "filename": "SampleDocument-sg.docx",
  "filedata": "{{base64data}}",
});
req.write(postData);
req.end();

Sample Code - Ruby

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

url = URI("https://plugin.rchilli.com/RChilliPlugin/rchilli/skillGapDetection")

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({
  "userkey": "Use Your userkey",
  "subuserid": "SubUser",
  "filename": "SampleDocument-sg.docx",
  "filedata": "{{base64data}}",
})

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

Sample Code - C#

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://plugin.rchilli.com/RChilliPlugin/rchilli/skillGapDetection");
var content = new StringContent("\r\n{\r\n    \"userkey\": \"Use Your userkey\",\r\n    \"subuserid\" : \"SubUser\",\r\n    \"filename\": \"SampleDocument-sg.docx\",\r\n    \"filedata\": \"{{base64data}}\",\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Sample Code - cURL

curl --location 'https://plugin.rchilli.com/RChilliPlugin/rchilli/skillGapDetection' \
--header 'Content-Type: application/json' \
--data '
{
    "userkey": "Use Your userkey",
    "subuserid" : "SubUser",
    "filename": "SampleDocument-sg.docx",
    "filedata": "{{base64data}}",
}'