Analyze Text

POST https://apiv2.indico.io/apis/multi
Make calls to many APIs in parallel.

Private cloud endpoint

POST https://[cloud].indico.domains/apis/multiapi/[batch]/

Arguments

data – String | List – required – text to be analyzed
apis – List – required – the list of APIs to run in parallel

Output

A dictionary where each key maps to the specified models’ results. If used on a single input (not recommemnded as using multiple APIs quickly uses up your allotted calls!) you’ll get the default response, otherwise a list of the default.

# single output
{
    'sentiment_hq': 0.7300551533699036,
    'political': {
        'Conservative': 0.2288717527904388,
        'Green': 0.05575739681227337,
        'Liberal': 0.6541234047231098,
        'Libertarian': 0.06124744567417795
    }
}

# batch output
{
    "political": [
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        },
        {
            'Conservative': 0.2288717527904388,
            'Green': 0.05575739681227337,
            'Liberal': 0.6541234047231098,
            'Libertarian': 0.06124744567417795
        }
    ], 
    "sentiment_hq": [0.7300551533699036]
}

Example

// Single Example
fetch('https://apiv2.indico.io/apis/multiapi', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: 'Democratic candidate Hillary Clinton is excited for the upcoming election.',
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));

// Batch Example
fetch('https://apiv2.indico.io/multiapi/batch?apis=twitterengagement,sentimenthq', {
  method: 'POST',
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    data: [
      'Democratic candidate Hillary Clinton is excited for the upcoming election.', 
      'Bill Clinton joins President Obama for a birthday golf game at Marthas Vineyard.'
    ],
  })
})
  .then(r => r.json())
  .then(response => {
    console.log(response);
  })
  .catch(err => console.log(err));