Show / Hide Table of Contents

Content Insights

Content Insights works for both uploaded files or by referencing a completed translation.

Note

In order to use this feature you need to have it enabled on your account.

Create Content Insights for files

This call creates the Content insights by sending the input and the Multipart form data.

Linux

curl -XPOST \
   -H "Content-Type:multipart/form-data" \
   -H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" \
   -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" \
   -F "sourceLanguage=eng" \
   -F "file=@\"./demo.txt\";filename=\"demo.txt\"" \
   -F "file=@\"./demo2.txt\";filename=\"demo2.txt\"" \
 'https://api.languageweaver.com/v4/content-insights'
Windows

curl -XPOST^
 -H "Content-Type:multipart/form-data"^
 -H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI"^
 -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555"^
 -F "sourceLanguage=eng"^
 -F "input=@\"demo.txt\";filename=\"demo.txt\""^
 -F "input=@\"demo2.txt\";filename=\"demo2.txt\""^
 https://api.languageweaver.com/v4/content-insights

Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials

HTTP Request
POST /v4/content-insights

Headers

Name Value (example) Description
Authorization Bearer asd0eXAi... Bearer token
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 Optional unique request identifier (UUID) provided by client

Request Body:

(Request Body)
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="file"; filename="demo1.txt"
Content-Type: multipart/form-data
Content-Length: 11
 
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="file"; filename="demo2.txt"
Content-Type: multipart/form-data
Content-Length: 50
 
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj
Content-Disposition: form-data; name="sourceLanguage"
Content-Type: text/plain;charset=UTF-8
Content-Length: 3
 
--bmmy1qevxni7T7MwlQcBYI6EvBdjoQj--

Request Parameters

Format
multipart/form-data

Name Type Mandatory Default value Description
sourceLanguage string yes Three letters language code of the source language
file file yes The binary content of the file

Response JSON:

{
  "contentInsightsId": "ec00a687-9a72-443a-b5cf-121da1c84789",
  "documents":[
    {
      "fileId": "f8acc566-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo1.txt"
    },
    {
      "fileId": "f8acasd6-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo2.txt"
    }
  ]
}

Response

Headers

Name Value (example) Description
BeGlobal-Request-ID dbbbc062-88a7-4783-8d52-dea795e517f4 Unique request identifier (UUID)
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 The identifier provided in the request (UUID)

Format
JSON

Name Type Description
contentInsightsId string The id of the content insights request. This has to be used for the subsequent calls
fileId string The id of each file sent for content insights. This has to be used for the subsequent calls
fileName string The name of each file sent for content insights
{
  "errors":[
    {
      "code":1047,
      "description":"File demo1.txt is empty"
    }
  ]
}

Error Response

Format
JSON

Name Type Description
errors list A list with the errors that occurred
code integer The code of the error
description string The description of the error

Returned HTTP Codes:

Http Code Description
202 When the content insights request is successfully initiated
400 When the input data is not valid
401 When the authentication process failed or the access token is not valid
403 Forbidden to access resource
500 Application internal error
Note

The file limit is set to 100 MB.

Create Content Insights for existing translations

This call allows you to perform content insights for a file that was already translated.

Linux

curl -XPOST \
   -H "Content-type: application/json" \
   -H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" \
   -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
   -d '{"translationIds": ["gfui83oah", "gfui83oah1"]}' \
https://api.languageweaver.com/v4/content-insights
Windows

curl -X POST -H "Content-type: application/json"^
    -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI"^
    -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" -d^
    "{^
        \"translationIds\": [\"gfui83oah\", \"gfui83oah1\"]^
     }" https://api.languageweaver.com/v4/content-insights

Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials

HTTP Request
POST /v4/content-insights

Headers

Name Value (example) Description
Authorization Bearer asd0eXAi... Bearer token
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 Optional unique request identifier (UUID) provided by client

Request Parameters

Format
JSON

Name Type Mandatory Default value Description
translationIds string array no empty A string array containing translation ids

Request JSON:

{
   "translationIds": ["gfui83oah", "gfui83oah1"]
}
Note

The translation ids must reference translations that are still available in the system. This means that the translation was either not retrieved yet, or 'Content deletion' is disabled for this account

Response JSON:

{
  "contentInsightsId": "ec00a687-9a72-443a-b5cf-121da1c84789",
  "documents":[
    {
      "fileId": "f8acc566-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo1.txt"
    },
    {
      "fileId": "f8acasd6-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo2.txt"
    }
  ]
}

Response

Headers

Name Value (example) Description
BeGlobal-Request-ID dbbbc062-88a7-4783-8d52-dea795e517f4 Unique request identifier (UUID)
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 The identifier provided in the request (UUID)

Format
JSON

Name Type Description
contentInsightsId string The id of the content insights request. This has to be used for the subsequent calls
fileId string The id of each file sent for content insights. This has to be used for the subsequent calls
fileName string The name of each file sent for content insights
{
  "errors":[
    {
      "code":1047,
      "description":"File demo1.txt is empty"
    }
  ]
}

Error Response

Format
JSON

Name Type Description
errors list A list with the errors that occurred
code integer The code of the error
description string The description of the error

Returned HTTP Codes:

Http Code Description
202 When the content insights request is successfully initiated
400 When the input data is not valid
401 When the authentication process failed or the access token is not valid
403 Forbidden to access resource
500 Application internal error

Check the Content Insights status

This call will allow the user to check the status of a previously created content insights.
The status can be: INIT, ACCEPTED, IN_PROGRESS, DONE, FAILED.

If the status is INIT, ACCEPTED or IN_PROGRESS then the status call has to be triggered again. You need to set a sleep time between the subsequent calls made to the status endpoint /v4/content-insights/{contentInsightsId} which should vary from 100 milliseconds for smaller inputs (up to 500 characters) to 500 milliseconds for larger inputs.

If the status is DONE the result of the content insights can be retrieved.

If the status is FAILED this signals that we cannot run content insights. When this status is returned, the Get Status calls must not be sent anymore.

Linux

curl -XGET -H 'Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI' -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
'https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789'
Windows

curl -XGET -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" ^
https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789

Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials

HTTP Request
GET /v4/content-insights/{contentInsightsId}

Headers

Name Value (example) Description
Authorization Bearer asd0eXAi... Bearer token
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 Optional unique request identifier (UUID) provided by client

Response JSON:

{
  "contentInsightsStatus":"INIT",
  "documents":[
    {
      "fileId": "f8acc566-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo2.txt",
      "summarization": {
        "status": "INIT"
      }
    },
    {
      "fileId": "f8acasd6-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo.txt",
      "summarization": {
        "status": "INIT"
      }
    }
  ]
}
{
  "contentInsightsStatus": "IN_PROGRESS",
  "documents": [
    {
      "fileId": "f8acc566-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo2.txt",
      "summarization": {
        "status": "IN_PROGRESS"
      }
    },
    {
      "fileId": "f8acasd6-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo.txt",
      "summarization":{
        "status": "DONE"
      }
    }
  ]
}
{
  "contentInsightsStatus":"DONE",
  "documents":[
    {
      "fileId": "f8acc566-1b3b-4ebc-b40a-69c51568ef75",
      "fileName": "demo2.txt",
      "summarization": {
        "status": "DONE"
      }
    },
    {
      "fileId": "f8acasd6-1b3b-4ebc-b40a-69c51568ef75",
      "fileName":"demo.txt",
      "summarization":{
        "status": "DONE"
      }
    }
  ]
}

Response

Headers

Name Value (example) Description
BeGlobal-Request-ID dbbbc062-88a7-4783-8d52-dea795e517f4 Unique request identifier (UUID)
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 The identifier provided in the request (UUID)

Format
JSON

Name Type Description
contentInsightsStatus string A string representing the status of the content insights process.
Can be one of the following:
INIT - source files were received by system and will be validated
ACCEPTED - the files were validated by the system and content insights can be generated
IN_PROGRESS - Content insights are being generated
DONE - Content insights were generated for the given files. When this status is returned then the Retrieve Content Insights call should be triggered.
FAILED - this state signals that we cannot run Content Insights. When this status is returned, the Get Status calls must stop because there is no way to recover from this state.
documents string array A string array with the list of files that were submitted for content insights
fileId string The id of the file
fileName string The name of the file
summarization string The content insights operation
status string The status of the content insights operation
{
  "errors":[
    {
      "code":43,
      "description": "Unknown status for requestId {0}"
    }
  ]
}

Error Response

Format
JSON

Name Type Description
errors list A list with the errors that occurred
code integer The code of the error
description string The description of the error

Returned HTTP Codes:

Http Code Description
200 When the content insights status is successfully returned
400 When the input data is not valid
401 When the authentication process failed or the access token is not valid
403 Forbidden to access resource
500 Application internal error

Retrieve Content Insights Results

This call returns the result of the aggregated content insights. The sentences that are part of the summary come from all the files that were part of the input.

Linux

curl -XGET -H 'Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI' -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
'https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789/result'
Windows

curl -XGET -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" ^
https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789/result

Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials

HTTP Request
GET v4/content-insights/{contentInsightsId}/result

Headers

Name Value (example) Description
Authorization Bearer asd0eXAi... Bearer token
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 Optional unique request identifier (UUID) provided by client

Response JSON:

{
  "contentInsightsId":"ec00a687-9a72-443a-b5cf-121da1c84789",
  "stats": {
    "inputWordCount": 5,
    "inputCharCount": 26
  },
  "sourceLanguage":"eng",
  "summarization":{
    "segments":[
      {
        "text":"The English word Alps derives from the Latin Alpes (through French).",
        "lineNumber":3,
        "score":0.5954782
      },
      {
        "text":"The peaks in the easterly portion of the range, in Austria and Slovenia, are smaller than those in the central and western portions.",
        "lineNumber":11,
        "score":0.5050102
      },
      {
        "text":"The countries with the greatest alpine territory are Switzerland, France (21.4%), Austria (28.7% of the total area) and Italy (27.2%).",
        "lineNumber":12,
        "score":0.4954782
      }
    ]
  }
}

Response

Headers

Name Value (example) Description
BeGlobal-Request-ID dbbbc062-88a7-4783-8d52-dea795e517f4 Unique request identifier (UUID)
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 The identifier provided in the request (UUID)

Format
JSON

Name Type Description
contentInsightsId string The id of the content insights request
stats object Content insights statistics
inputWordCount int Number of input words in the source files
inputCharCount int Number of input characters in the source files
sourceLanguage string Three letters language code of the source language
summarization object Object containing the sentences from the input files that were selcted as part of the summary
segments array The array with the sentences from the input files that were selcted as part of the summary
text string A sentence from the input files that was selected to be part of the summary
lineNumber int The line number of the sentence in the input file
score int A score between 0 and 1. The higher the score, the more representative the sentence is for the summary
{
  "errors":[
    {
      "code":42,
      "description": "Invalid requestId {0}"
    }
  ]
}

Error Response

Format
JSON

Name Type Description
errors list A list with the errors that occurred
code integer The code of the error
description string The description of the error

Returned HTTP Codes:

Http Code Description
200 When the content insights content is successfully returned
400 When the input data is not valid
401 When the authentication process failed or the access token is not valid
403 Forbidden to access resource
500 Application internal error

Retrieve Content Insights Results for one file

This call will allow the user to get the result of the content insights for a single file.

Linux

curl -XGET -H 'Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI' -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
'https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789/file/f8acc566-1b3b-4ebc-b40a-69c51568ef75/result'
Windows

curl -XGET -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" ^
https://api.languageweaver.com/v4/content-insights/ec00a687-9a72-443a-b5cf-121da1c84789/file/f8acc566-1b3b-4ebc-b40a-69c51568ef75/result

Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials

HTTP Request
GET /v4/content-insights/{contentInsightsId}/file/{fileId}/result

Headers

Name Value (example) Description
Authorization Bearer asd0eXAi... Bearer token
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 Optional unique request identifier (UUID) provided by client

Response JSON:

{
  "contentInsightsId":"ec00a687-9a72-443a-b5cf-121da1c84789",
  "fileId":"f8acc566-1b3b-4ebc-b40a-69c51568ef75",
  "fileName":"SDL.docx",
  "stats": {
    "inputWordCount": 5,
    "inputCharCount": 26
  },
  "summarization":{
    "segments":[
      {
        "text":"The English word Alps derives from the Latin Alpes (through French).",
        "lineNumber":3,
        "score":0.5954782
      },
      {
        "text":"The peaks in the easterly portion of the range, in Austria and Slovenia, are smaller than those in the central and western portions.",
        "lineNumber":11,
        "score":0.5050102
      },
      {
        "text":"The countries with the greatest alpine territory are Switzerland, France (21.4%), Austria (28.7% of the total area) and Italy (27.2%).",
        "lineNumber":12,
        "score":0.4954782
      }
    ]
  }
}

Response

Headers

Name Value (example) Description
BeGlobal-Request-ID dbbbc062-88a7-4783-8d52-dea795e517f4 Unique request identifier (UUID)
Trace-ID 2c0c4dda-8333-4538-983e-e098de7cf555 The identifier provided in the request (UUID)

Format
JSON

Name Type Description
contentInsightsId string The id of the content insights request
fileId string The id of the file
fileName string The name of the file
stats object Content insights statistics
inputWordCount int Number of input words in the source files
inputCharCount int Number of input characters in the source files
sourceLanguage string Three letters language code of the source language
summarization object Object containing the sentences from the input files that were selcted as part of the summary
segments array The array with the sentences from the input files that were selcted as part of the summary
text string A sentence from the input files that was selected to be part of the summary
lineNumber int The line number of the sentence in the input file
score int A score between 0 and 1. The higher the score, the more representative the sentence is for the summary
{
  "errors":[
    {
      "code": 42,
      "description": "Invalid requestId {0}"
    }
  ]
}

Error Response

Format
JSON

Name Type Description
errors list A list with the errors that occurred
code integer The code of the error
description string The description of the error

Returned HTTP Codes:

Http Code Description
200 When the content insights content is successfully returned
400 When the input data is not valid
401 When the authentication process failed or the access token is not valid
403 Forbidden to access resource
500 Application internal error
In This Page
Back to top