Common GraphQL Queries

Most of the Python client library is built around GraphQL queries to the Indico API. Importantly, the library makes sure that these queries are properly formatted and parameterized and, when they aren’t, provides informative error messages and handles some common problems. Therefore, we strongly recommend for most use cases that you use the client library. However, if you would still like to work directly with GraphQL, many of the most common queries are provided below along with the variables required.

If you are unable to find a query you’d like to use from below, you can also find many queries in the python library’s source code (e.g. you can find queries related to Workflows here).

Note: users can be assigned GraphQL access w/in the Indico IPA by an administrator to access https://try.indico.io/graph/api/graphql (or equivalent w/ your company’s base domain in place of try.indico.io). From here, you can test queries as well as see the full schema of available variables.

Job Status (w/ result):

query JobStatus($id: String) {
            job(id: $id) {
                id
                ready
                status
                result
            }
        }

Variables (the job’s ID, looks like example below): {“id”: “3e50f5e6-70c5-424e-9064-9fba12b5ba17”}

List Datasets:

query ListDatasets($limit: Int){
    datasetsPage(limit: $limit) {
        datasets {
            id
            name
            rowCount
        }
    }
}

Variables {“limit”: 100} # Number of datasets to return

Get Datasets and Delete Dataset:

query GetDataset($id: Int) {
        dataset(id: $id) {
            id
            name
            rowCount
            status
            permissions
            datacolumns {
                id
                name
            }
            labelsets{
                id
                name
            }
        }
    }


mutation deleteDataset($id: Int!) {
    deleteDataset(id: $id) {
        success
    }
}

Variables {“id”: 423} # id of the dataset object you want or want to delete

Create Dataset:

mutation CreateDataset($metadata: JSONString!) {
    newDataset(metadataList: $metadata) {
        id
        status
    }
}

Variables {“metadata”: ‘{“files”: [“path/to/upload.csv”,], “name”: “my_dataset”, “wait”: true}’} You must include the following variables in a json (like above): name (str): Name of the dataset files (List[str]): List of pathnames to the dataset files wait (bool): Wait for the dataset to upload and finish

Document Extraction:

mutation($files: [FileInput], $jsonConfig: JSONString) {
    documentExtraction(files: $files, jsonConfig: $jsonConfig ) {
        jobIds
    }
}

Variables {“files”: [“path/to/my.pdf”, “path/to/myother.pdf”], “json_config”: ‘{“preset_config”: “ondocument”}’} files= (List[str]): Pathnames of one or more files to OCR json_config (dict or JSON str): Configuration settings for OCR.

Get Model Group:

query GetModelGroup($id: Int){
    modelGroups(modelGroupIds: [$id]) {
            modelGroups {
                id
                name
                status
                taskType
                selectedModel {
                    id
                    status
                }
            }
        }
    }

Variables {“id”: 232} # model group ID (can be found on the model’s page in the app)

Get Model Predictions:

mutation ModelGroupPredict(<QUERY_ARGS>) {
    modelPredict(<MODEL_PREDICT_ARGS>) {
        jobId
    }
}

Variables In the query above, replace <QUERY_ARGS> with modelId and the text to predict on like: “$modelId: 342,$data: [‘example text’, ‘more text’]”

And replace <MODEL_PREDICT_ARGS> with predcition options as a json string, like: “predictOptions”: ‘{“load”: false}’