NAV Navbar
Logo
visualbasic shell xillio

Introduction

Welcome to the documentation of MICC API. In this documentation you can find all the api calls with their specifics.

REST API 1.0 Calls

Test if server is running

The following request should be used when you want to make sure the server is running.

HTTP Request

GET http://85.214.132.72:8205/MICCAPI/helloworld

Query Parameters

None

Return

“Server is working!” as a text string when API server is working.

Get text from file

The following request can be used to extract the text from a file, also if the file is pdf - the text can be specified to extract only the first page or the entire document.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/getText

Body Parameters

Parameter Type Description
file File The file that is getting text extracted from.
allpages String only for pdf - 0 - only first page, 1 - entire text. For other formats just send 1.

Return

As a result the extracted text from the file is returned.

Extract pages from PDF

The following request can be used to extract pages from a pdf. by sending the pdf file with the specified start and end page. Keep in mind that another request needs to be send to retrieve the resulted file.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/extractPages

Body Parameters

Parameter Type Description
file File The file that is getting pages extracted from.
start_page String The starting page of extraction.
end_page String The final page of extraction (includes everything from start to end including start and end pages).

Return

“Success” if the document has been uploaded and extracted pages from start to end successfully.

Get extracted pages document

The following request is send after the aforementioned one to retrieve the document with the extracted pages.

HTTP Request

GET http://85.214.132.72:8205/MICCAPI/extractPages

Query Parameters

None

Return

Extracted pages file with name: tempResult.pdf

Merge pdfs

The following request can be used to merge any amount of pdf files into one pdf file.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/mergePDF

Body Parameters

Parameter Type Description
name_doesnt_matter File File that is going to be merged

(You can put any number of files in the body of the request with whatever names you want as long as they don’t contain illegal characters)

Return

“Success” if the documents have been uploaded and the pdf files merged successfully.

Get merged pdf

The following request is send after the aforementioned one to retrieve the merged pdf.

HTTP Request

GET http://85.214.132.72:8205/MICCAPI/mergePDF

Query Parameters

None

Return

Merged pdf file.

Tesseract OCR

The following request sends a file to the API which will have it’s text extracted and returned as response. Also makes file for the next GET request to get the extracted text in a file.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/tesseractOCR

Body Parameters

Parameter Type Description
file File File for text extraction. Supported formats are - BMP, PNM, PNG, JFIF, JPEG, and TIFF.
language String Language code, can be found here: https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#languages

Return

Returns the extracted text from the file.

Tesseract OCR GET file

The following request gets the last extracted text from image file as .txt file.

HTTP Request

GET http://85.214.132.72:8205/MICCAPI/tesseractOCR

No parameters

Return

Returns the extracted text inside a tempOCRResult.txt file.

Language Detect

The following request sends a text and in response returns the language of that text.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/languageDetect

Body Parameters

Parameter Type Description
text String Text to detect language from.

Return

Returns the language of the text e.g. en, nl etc…

NLPAnalysis

The following request sends string for analysis along with language and optional parameters. If the language is Dutch parameters are not needed as it redirects the request to NLPAnalysis.Dutch. To learn more about the “custom options” please contact us.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/nlpAnalysis

Body Parameters

Parameter Type Description
string_for_analysis String String to give NLPAnalysis.Dutch and retrieve it’s analysis.
language String Language of the text being sent.
properties String (Optional) Only needed for non - Dutch languages.
“custom options” String (Optional) contact us to learn more.

Return

Returns the result from analysis separating different parts with “\n” for dutch. For non - dutch languages the result is custom to the specified properties or the other custom options.

NLPAnalysis.Dutch

The following request gets a string that is being passed as parameter and gives it for analysis and after that retrieves the result.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/nlpAnalysisDutch

Body Parameters

Parameter Type Description
string_for_analysis String String to give NLPAnalysis.Dutch and retrieve it’s analysis.

Return

Returns the result from analysis separating different parts with “\n”.

Execute Script

The following request executes a report script that has been first internally added.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/executeScript

Body Parameters

Parameter Type Description
reportName String Name of the report that needs to be executed.
parameters String Parameters passed to the report script.

Return

Returns the result of the executed report script.

Document Similarity

The following request gets two texts and returns their similarity between 0 and 1, 0 being no similarity and 1 being exact same texts.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/documentSimilarity

Body Parameters

Parameter Type Description
text1 String First String for similarity check.
text2 String Second String for similarity check.

Return

Returns a result between 0 and 1, example: 0.33587786259541985, which shows they are about 1/3 similar.

Add train file to project

The following request adds the file send by the request to the specified projectName with specified document_type.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/addTrainFile

Body Parameters

Parameter Type Description
file File The file that is being uploaded to the server.
projectName String The name of the project where the file needs to be put for training.
document_type String Used to distinguish different labels in the project training folder.

Return

“Success” if the upload to the specified project and document_type folder is successfull.

Train project

To train a project, use this code:

    Dim request As WebRequest = WebRequest.Create("http://85.214.132.72:8205/MICCAPI/train?project_name=" & projectName)
    request.Credentials = CredentialCache.DefaultCredentials
    CType(request, HttpWebRequest).UserAgent = ".NET Framework Example Client"
    request.Method = "POST"
    request.ContentType = "multipart/form-data"
    Dim response As WebResponse = request.GetResponse()
    If (Convert.ToString(CType(response, HttpWebResponse).StatusCode) Like "200") Then
        trainClassifiers = True
    Else
        trainClassifiers = False
    End If

The following request trains the project specified in parameter. To be able to use this function make sure that the project folder on the server has “classifiers” and “train” folders. The train folder should contain every label as a folder and inside every folder txt files with text used to build to model. Also selected classifiers for the project has to be present inside the database.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/train

Query Parameters

Parameter Type Description
project_name String String specifing the project that is going to be trained.

Return

“Success” if the project was trained successfully.

Classification

To classify with specific project, use this code:

    Dim destinationURL As String = "http://85.214.132.72:8205/MICCAPI/classify?project_name=" & projectName & "&string_for_classification=" & Uri.EscapeDataString(string_for_classification)
    Dim request As WebRequest = WebRequest.Create(destinationURL)
    request.Credentials = CredentialCache.DefaultCredentials
    CType(request, HttpWebRequest).UserAgent = ".NET Framework Example Client"
    request.Method = "POST"
    request.ContentType = "multipart/form-data"
    Dim response As WebResponse = request.GetResponse()

    Dim ReceiveStream As Stream = response.GetResponseStream()
    Dim encode As Encoding = System.Text.Encoding.GetEncoding("utf-8")
    ' Pipe the stream to a higher level stream reader with the required encoding format.
    Dim readStream As New StreamReader(ReceiveStream, encode)
    Dim responseResult As String = ""
    Dim read(8096) As [Char]

    ' Read 8096 charcters at a time    .
    Dim count As Integer = readStream.Read(read, 0, 8096)
    While count > 0
        Dim str As New [String](read, 0, count)
        responseResult = str
        count = readStream.Read(read, 0, 8096)
    End While

    Dim classifiersAndClassificationsDict As Object = CreateObject("Scripting.Dictionary")
    Dim classifiersAndClassifications As String() = Regex.Split(responseResult, "%")
    For Each classifierClassification As String In classifiersAndClassifications
        classifiersAndClassificationsDict.Add(classifierClassification.Split("#")(0), classifierClassification.Split("#")(1))
    Next

    Dim result As Object = classifyText(classifiersAndClassificationsDict)

The following request gets string to be used for classification as parameter and the name of the project which needs to classify the string.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/classify

Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.
text String String that needs to be classified.

Return

Returns the result from the classification in the following format:

classifier#label,probability?label,probability?la…%classifier#label,probability?label…

Classification Batch

The following request gets the name of the project which needs to be classified in the database using Mallet.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/classifyBatch

Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.

Return

“Success” if the classification of the entire database went through.

Classify Project

The following request gets the name of the project which needs to be classified in the database using configuration.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/classifyProject

Query Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.

Return

“Success” if the classification of the entire database went through.

Classify Project Single

The following request gets the name of the project which is needed to identify the configuration to be used and string to be classified.

HTTP Request

POST http://85.214.132.72:8205/MICCAPI/classifyProjectSingle

Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.
text String String that needs to be classified.

Return

The result of the classification - label.

Extras

This section contains documentation on topics that are not big enough for their own section.

AutoStore 7 MigratoConnector.dll integration guide

    Dim migrato, result
    EKOManager.StatusMessage "Calling Migrato webservice...."
    Set migrato = CreateObject("MigratoConnector")
    result = migrato.GetClassification("FileShare-demo", "test text")
    EKOManager.StatusMessage "Status = " & "Success"
    EKOManager.StatusMessage "Result = " & result
  1. Get the dll from here
  2. Choose a folder where to keep the dll. For test I created Migrato folder in Notable Solutions\AutoStore7 and put it inside.
  3. Launch a cmd in administrator mode
  4. Go to the folder containing the dll within the cmd
  5. Execute the following command: C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /tlb /codebase MigratoConnector.dll
  6. Optional: Test the integration with the code in the visualbasic code tab.

Azure Classification REST API Calls

Create Project Request

This request will create new project inside the API with the given service API.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/createProject

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name that has to be used in the future for model uploads and classificaitons. Has to be less than 16 characters, all lowercase and alphanumeric.
resource_group String String specifing the resource group of the project inside Microsoft Azure.

Return

There are 4 different messages that can be returned:

  1. “Success” on successful project creation.
  2. “Project name too long (or empty)! Please write a name with 16 or less characters.” this is a strict requirment due to Azure.
  3. “Only lowercase letters and numbers are allowed!” another requirement due to Azure.
  4. “Project already exists!” if such project already exists on the server, this message will be returned.

Upload model Request

This request will upload a model inside of the Project in the API.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/uploadModel

Query & Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.
model File File containing the model used for classification. (Body)
model_input_model File File containing the input model for the model used for classification. (Body)
model_encoding File File containing the encoding of the labels of the model. (Body)
overwrite String (Not mandatory) Default value is “false”. “true” and “false” are the only accepted values. On “true”, if the model is already uploaded, it will be overwritten, on “false” it won’t.

Return

“Success” on successful model upload.

Single Classification Request

This request will send a request based on project_name to its corresponding hosted service on Azure using all uploaded models.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/classifyText

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.
text String String that needs to be classified.

Return

A json containing all classifications made by uploaded classifiers including their confidence. Here is an example: { "BernoulliNB_probability":"-1.0", "NearestCentroid_prediction":"TRAINING_CURSUSAANVRAAG_9", "MultinomialNB_prediction":"OVERIGE_VERKLARINGEN_EN_INFO_2", "NearestCentroid_probability":"1.0", "BernoulliNB_prediction":"IDENTIFICATIEDOCUMENT_5", "RidgeClassifier_prediction":"OVERIGE_VERKLARINGEN_EN_INFO_2", "LogisticRegression_probability":0.018535298598120812, "SVC_prediction":"CERTIFICAAT_1", "MultinomialNB_probability":0.027295630704862624, "LinearSVC_prediction":"OVERIGE_VERKLARINGEN_EN_INFO_2", "LogisticRegression_prediction":"OVERIGE_VERKLARINGEN_EN_INFO_2", "PassiveAggressive_probability":"-1.0", "NeuralNet_prediction":"TRAINING_CURSUSAANVRAAG_4", "PassiveAggressive_prediction":"SOLLICITATIE_CV_1", "SVC_probability":137.06061432383416, "RidgeClassifier_probability":-0.653839095189955, "NeuralNet_probability":"-1.0", "LinearSVC_probability":-0.576450117215193 }

Database Classification Request

This request will send a request based on project_name to its corresponding hosted service on Azure using all uploaded models to do classification over the given database.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/classifyTextDatabase

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project that is going to be used for the classification.
db_host String Database’s host adress IP.
db_user String Database’s user to connect with.
db_password String Database’s password for the user.
db_name String Database’s name where core_assets resides in.

Return

There are 3 different messages that can be returned:

  1. “Success” on successful classification of the documents in the database.
  2. “The service is stopped or still not hosted!”, Serivce still hasn’t been created or it’s stopped.
  3. “Failure” If some internal error occured this message will be returned.

Create Service from Project Request

This request will create a Machine Learning Instance inside of Azure, which can be used for classification requests. Important to note - all classifiers need to be uploaded in order for this to work.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/createService

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name of which to host a service

Return

There are 4 different messages that can be returned:

  1. “Success” on successful service hosted on Azure.
  2. “Error” if there was an error along the way during service hosting/uploading.
  3. A list of models (pkl) files that are still missing and need to be uploaded. On how to upload pelase check “Upload model Request”
  4. “Service for this project already exists”, this message appears only if service is already hosted on Azure.

Get Classifiers Request

This request will retrieve the classifiers currently in the hosted on Azure if “service” is sent as scope, if “server” is sent it will return all the currently uploaded “.pkl” files in that project.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/getClassifiers

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name for which the classifiers to be retrieved.
scope String Parameter specifying the scope to either “server” or “service”. Server will return all uploaded “.pkl” files while service will check for which are the currently hosted and running models on this project’s Azure service.

Return

There are 3 different messages:

  1. (service) String containing all the available classifiers inside square brackets and dvidied with “,”. Example: [BernoulliNB, NearestCentroid, MultinomialNB, RidgeClassifier, LogisticRegression, SVC, LinearSVC, PassiveAggressive, NeuralNet]

  2. (server) String containing all the “pkl” files uploaded for this project inside square brackets and dvidied with “,”. Example: [LinearSVC_3_input_model.pkl, LogisticRegression_3_input_model.pkl, BernoulliNB_1_input_model.pkl, NearestCentroid_3_input_model.pkl, PassiveAggressive_4_encoding.pkl, RidgeClassifier_3.pkl, LogisticRegression_3.pkl, BernoulliNB_1.pkl, PassiveAggressive_4.pkl, SVC_3.pkl, NeuralNet_2_input_model.pkl, SVC_3_encoding.pkl, MultinomialNB_3_encoding.pkl, NearestCentroid_3.pkl, NearestCentroid_3_encoding.pkl, LinearSVC_3.pkl, PassiveAggressive_4_input_model.pkl, LinearSVC_3_encoding.pkl, RidgeClassifier_3_encoding.pkl, MultinomialNB_3.pkl, MultinomialNB_3_input_model.pkl, SVC_3_input_model.pkl, LogisticRegression_3_encoding.pkl, RidgeClassifier_3_input_model.pkl, NeuralNet_2.pkl, NeuralNet_2_encoding.pkl, BernoulliNB_1_encoding.pkl]

  3. “Please check your scope parameter.”, this is returned if the scope parameter is not “service” or “server”, these are the only allowed values.

Start Project Request

This request will start the project’s container Instance on Azure.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/startProjectContainerInstance

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name

Return

“Success” on successful project start.

Stop Project Request

This request will stop the project’s container Instance on Azure.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/stopProjectContainerInstance

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name

Return

“Success” on successful project stop.

Restart Project Request

This request will restart the project’s container Instance on Azure.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/restartProjectContainerInstance

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name

Return

“Success” on successful project restart.

Update URI Project Request

This request will update the uri based on the project’s container Instance on Azure.

HTTP Request

POST http://85.214.132.72:8303/ClassificationAPI/updateURI

Query/Body Parameters

Parameter Type Description
project_name String String specifing the project name

Return

“Success” on successful project uri update.

Errors

MICC REST API uses the following status codes:

Status Code Meaning
400 Invalid form/format - Invalid form or format is being used in parameters for extracting pages.
499 Fail - Failed to train a project
500 Can’t save file – Can’t save file for extracting pages/uploading train file.
501 Classificaion folder creation Exception – Failed to create classification folder during project initialization
520 Project is missing from the projects table inside migratocc database.
521 Specified database inside projects table in migratocc is either a NULL value or unexisting database.
522 core_assets table inside the projects database is either missing or is misconfigured e.g. missing columns.
530 Configuration file of the given project is either missing or is broken/corrupted.
531 config.properties file is missing from glassfish config folder.
540 Exception has happened during unique identifier check.
541 Exception has happened during specific multiple header lines check.
542 Exception has happened during specific header line check.
543 Exception has happened during key terms check.
544 Exception has happened during multi terms check.
549 Exception has happened inside check headers, but has been called with new kind of terms/headers that are still not added in exceptions.
550 Exception has happened during results processing.

VNC server too many authentication failures

To deal with this problem you just need to access your pc through ssh. Type the following commands one after another: “vncserver -kill :1” “vncserver” This should restart the vnc server and you should be able to access it.