Text Inspector API (2.1.0)

Download OpenAPI specification:

This document describes the current programmatic API (version 2) that is made available to some users of the Text Inspector product created by WebLingua.

The document is intended for a technical audience, and assumes an understanding of RESTful APIs, HTTPS, JSON and other technical details.

Using the API

To analyse a piece of text and obtain the analysis results for the different Text Inspector parsers requires multiple requests to be made to the API.

You first need to authenticate with the API to create a user session (createsession) and obtain a “sessionid”. That “sessionid” is then passed in all subsequent API requests.

During a session you can submit any number of texts for analysis - if you want to analyse multiple texts you do not need to create a new session for each.

Once you have a session you then submit your text for analysis. On successful submission of your text you will be returned what we call a “context id” (or “ctxId”). This context id is unique for that piece of texts analysis in your session, and is used for obtaining the analysis results from the different Text Inspector parsers.

Once you have a context id you would then request the results from the parser(s) that you are wanting the analysis results for.

An example flow of API requests might be:
1. Create session and obtain your “sessionid”.
2. Submit new text for analysis and obtain the analysis “ctxId”.
3. Get statistics parser results.
4. Get tagger parser results.
5. Submit second text for analysis and obtain the analysis “ctxId”.
6. Get scorecard parser results
7. etc.

For more information or to discuss getting access to the Text Inspector API, please contact your Web Lingua or Text Inspector account manager, or mail the Text Inspector help team textinspectorhelpteam@gmail.com

Create Session

To use the API you need to first authenticate with the API to create a user session - doing this will return you a sessionid. That session ID needs to be remembered and passed as a cookie header to all subsequent requests in the session.
During a session you can analyse and get the results for any number of different texts.
To authenticate and get the Session ID you have to make a createsession API call
Authentication is done with HTTP Basic Authentication, and as such you can supply the username/password either inline in the URL, or in an “Authentication” HTTP header.

query Parameters
encoded_string
string
Example: encoded_string=base64_encode(test@example.com:abc!123)

To send the username/password in an “Authentication” HTTP header the username and password need to be concatenated with a colon (“:”) and then Base64 encoded.

Responses

Request samples

curl -X GET “https://textinspector.com/api/v2/createsession" -H
"accept: application/json" -H "Authorization: Basic {encoded_string}" -L

Response samples

Content type
application/json
Example
{
  • "success": 1,
  • "sessionid": "731999172284994221689694364605242328"
}

Text Analysis Api

New Analysis

Submit a document for processing.

You can submit one or multiple texts at the same time. If submitting multiple texts then they should be separated by a “delimiter” character (specified in the request, defaulting to “#”), and the “split” parameter should be set to “1”.
The “newanalysis” API call returns a ctxId and the count of the number of documents processed. Use the ctxId and appropriate document number(s) in subsequent requests to get results from different parsers.

Request Body schema: application/json
required

Body request: JSON data that must be sent.

text
required
string

The document text to process.

delimiter
string

Character used to split multiple documents in the text.

split
string

If it is "1", the text will be divided into multiple documents according to the delimiter.

textmode
string
Enum: "Writing" "Reading" "Listening"

Analysis mode (Writing or Reading or Listening).

Responses

Request samples

Content type
application/json
{
  • "text": "Try+the+tool+out+with+this+paragraph+of+text...",
  • "delimiter": "%23",
  • "split": "1",
  • "textmode": "Writing"
}

Response samples

Content type
application/json
{
  • "response": {
    },
  • "name": "api_start",
  • "type": "api_start"
}

Statistics

Get the results for the “Statistics” parser

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/statistics"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "name": "Statistics",
  • "type": "statistics",
  • "response": {
    },
  • "exists": 1
}

Diversity

Get the results for the “Lexical Diversity” parser

query Parameters
ctxID
string
Example: ctxID=13C2AB3E-9C1D-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/diversity"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "exists": 1,
  • "response": {
    },
  • "type": "diversity",
  • "name": "Lexical Diversity"
}

Tagger

Get the results for the “Tagger” parser

query Parameters
ctxID
string
Example: ctxID=39A03A6A-9C1D-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/tagger"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "type": "tagger",
  • "name": "Tagger",
  • "exists": 1,
  • "response": {
    }
}

Metadiscourse

Get the results for the “Metadiscourse” parser

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/metadiscourse"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "type": "metadiscourse",
  • "name": "Metadiscourse",
  • "exists": 1,
  • "response": {
    }
}

Scorecard

Get the results for the “Scorecard” parser

query Parameters
ctxID
string
Example: ctxID=9B4B3D80-9C1F-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/scorecard"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "example": {
    }
}

Scorecard Rating

Get the results for the overall rating only from the “Scorecard” parser.

query Parameters
ctxID
string
Example: ctxID=400A816C-9D6C-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/scorecardrating"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "example": {
    }
}

Lexical Parsers

English Vocabulary Profile

Get the results for the “Lexical:EVP” parser

query Parameters
ctxID
string
Example: ctxID=21B42CDE-9C1F-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/taggedlexical-bnc"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "example": {
    }
}

British National Corpus

Get the results for the “Lexical:BNC” parser

query Parameters
ctxID
string
Example: ctxID=4FA10FD2-9C1E-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/taggedlexical-bnc"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "type": "taggedlexical-bnc",
  • "name": "Lexis: BNC",
  • "exists": 1,
  • "response": {
    }
}

Corpus Of Contemporary American English

Get the results for the “Lexical:COCA” parser

query Parameters
ctxID
string
Example: ctxID=79426E30-9C1E-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/taggedlexical-coca"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "example": {
    }
}

Academic Word List

Get the results for the “Lexical:AWL parser

query Parameters
ctxID
string
Example: ctxID=D8A74472-9C1E-11E9-8312-C7672007AC3E

The Context ID to be processed.

docNum
string
Example: docNum=1

Number of document to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/academicwordlist"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "example": {
    }
}

Tagged data

Get the tagged data for the parsers. This will give you the results for all documents in the analysis- you don’t need to request each document separately.

Tagger

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/tagger/taggeddata"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}

Metadiscourse

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/metadiscourse/taggeddata"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}

British National Corpus

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/taggedlexical-bnc/taggeddata"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}

Corpus Of Contemporary American English

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/taggedlexical-coca/taggeddata"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}

Academic Word List

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/doc{docNum}/statistics"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}

English Vocabulary Profile

query Parameters
ctxID
string
Example: ctxID=AC07A97C-9C1C-11E9-AB5C-DDF6D7F2BACF

The Context ID to be processed.

Responses

Request samples

curl -X GET
"https://textinspector.com/api/v2/{ctxID}/lexical/taggeddata"
-H "accept: application/json" -H "Cookie:
textinspector.session={sessionid};" -L

Response samples

Content type
application/json
{
  • "doc1": [
    ],
  • "doc2": [
    ]
}