Flow Results Export API

The Flow Results Export API exports Flow Review results to an annotation set.

Exporting to an Annotation Set

Method Syntax
POST URL_BASE/api/v1/flow/results/export_to_dataset

Description

Start a job that exports flow results to an annotation set by sending a POST request to URL_BASE/api/v1/flow/results/export_to_dataset with the request body encoded as JSON.

Request parameters

All parameters are required.

Parameter Type Description Values
ibresults_path string The path to a flow results file whose results you want to export, such as /space/subspace/fs/Instabase Drive/flow_proj/out/batch.ibflowresults Path to a valid .ibflowresults file.
new_dataset_parent_path string The folder to create the annotation set in, such as /space/subspace/fs/Instabase Drive/my_folder Path to a folder in the Instabase file system.
new_dataset_name string The name of the annotation set, i.e. my_new_annotation_set. A string.
class_schemas Dict The class schema of the flow results. The annotation set’s class schema will be generated based on this schema. A dictionary with the format as shown below.
{
  'class_1': [
    {
      'name': 'field_name_1',
      'type': 'Text'
      // possible values for type are: Text, Text_Multiple_Instances, List, Table
    },
    {
      'name': 'field_name_2',
      'type': 'List'
    },
    ... // all other fields for this class that you want to export
  ],
  'class_2': [ ... ],

  // For records in your flow results that have no class label, they will be
  // labeled with this class and have these fields.
  'FLOW_REVIEW_NULL_CLASS_LABEL': [ ... ]
}

Response schema

All keys are returned in the response by default.

Key Type Description
job_id string The ID of the job that was started. See Job status API for details about how to check when the job is completed.
message string If the request is invalid, this field returns an error message.

Examples

Request

Example (Python):

url = url_base + '/api/v1/flow/results/export_to_dataset'

args = {
  "ibresults_path": "/jaydoe/my_repo/fs/Instabase Drive/flow_proj/out/batch.ibflowresults",
  "new_dataset_parent_path": "/jaydoe/my_repo/fs/Instabase Drive/datasets",
  "new_dataset_name": "new_dataset",
  "class_schemas": {
    "paystub": [
      {
        'name': 'name',
        'output_type': 'TEXT'
      },
      {
        'name': 'earnings',
        'output_type': 'EXTRACTED_TABLE'
      }
    ]
  }
}
json_data = json.dumps(args)

headers = {
  'Authorization': 'Bearer {0}'.format(token)
}

r = requests.post(url, data=json_data, headers=headers)
resp_data = json.loads(r.content)

# message will be empty if there is no error in the API
message = resp_data.get('message')

# use this job id to query the job status
job_id = resp_data.get('job_id')

Response

The response body is a JSON object.

If successful, the response returns the job ID with a status code in the 200 range, for example:

HTTP STATUS CODE 200

{
  "job_id": "3ee4b5bf-3b22-419b-850f-ea9e02cf63a8"
}

If unsuccessful, the response returns an error message with a status code in the 400 or 500 range, for example:

HTTP STATUS CODE 400

{
  "message": "Annotation set parent folder /jaydoe/my_repo/fs/Instabase Drive/datasets does not exist"
}