REST Examples

The JoinVision backend supports several GET and POST REST calls, see the REST API documentation for more detail. The following examples show exemplary implementations for the Get Domains method using GET and Extract method using POST.

The GET example returns the latest domain value lists with English values in a JSON format. See the Rest API Reference for information on different parameters.

The POST example returns a structured XML containing all extracted information for a provided input file named “document.pdf”. Based on the selected Extraction Model, the returned XML validates against the respective XML Schema for the applied extraction mode.

Throughout the examples a placeholder is used instead of a valid product token. Replace <Product-Token> with your own token. Some of the examples use external libraries. Implementation steps may vary depending on the chosen library, please refer to the respective documentation.

Node.js / Javascript

Get Domains

var https = require('https'); var options = { host: 'cvlizer.joinvision.com', port: '443', path: '/cvlizer/rest/v1/domains/json/en', method: 'GET', headers: { Authorization: 'Bearer ' + <Product-Token> } }; var request = http.request(options, function (res) { if(res.statusCode !== 200){ console.log(res.statusCode); console.log(res.headers); } var str = ""; res.on("data", function(chunk) { str += chunk; }); res.on("end", function() { console.log(str); }); }); request.end();

Extract

var https = require('https'); var fs = require('fs'); var filename = "document.pdf"; fs.readFile(filename, function(err, file_data){ if (err) { throw err; } var base64 = new Buffer(file_data).toString('base64'); var data = JSON.stringify({ "model" : "cvlizer_3_0", "language" : "de", "filename":filename, "data":base64 }); var postheaders = { 'Content-Type' : 'application/json', 'Authorization': "Bearer " + <Product-Token> }; var postOptions = { host: "cvlizer.joinvision.com", port: "443", path: "/cvlizer/rest/v1/extract/xml", method: 'POST', headers: postheaders }; var request = https.request(postOptions, function (res) { if(res.statusCode !== 200){ console.log(res.statusCode); console.log(res.headers); } var str = ""; res.on("data", function(chunk) { str += chunk; }); res.on("end", function() { console.log(str); }); }); request.write(data); request.end(); });

Python 3

Get Domains

import requests r = requests.get('https://cvlizer.joinvision.com/cvlizer/rest/v1/domains/json/en', headers={'Authorization': 'Bearer <PRODUCT-TOKEN>'}) print(r.content.decode('utf-8'))

Extract

PHP

Get Domains

Extract

Ruby

The following example uses the “rest-client”-gem in version 1.8.0. It can be installed with this command:

Get Domains

Extract

Java

The examples use Jersey 2.X. Please note both examples are excerpts which are not runnable without an encapsulating class.

Get Domains

Extract

Apache Commons components are used for Base64 encoding.

C#

Get Domains

Extract