Using DMM Public APIs

In a production settings, you can integrate DMM with your model hosting systems using the public APIs made available on DMM. This allows you to automate some of the repetitive tasks through APIs. Following is the list of currently available APIs.

List Models

This API enables users to list all the models registered with DMM within the user’s organization.

Request Format:

GET  `/api/v0/models/list_models`

Sample Request:

curl --location --request GET 'https://develop.dmm.domino.tech/api/v0/models/list_models' \
--header 'Authorization: <DMM-API-TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw ''

Sample Response:

[
    {
        "id": "5eb505fc984c0610c5673653",
        "name": "PropensityPrediction",
        "modelType": "classification",
        "modelVersion": "1",
        "description": "Propensity to purchase prediction",
        "dateRegistered": "2020-05-08T07:10:52.471000",
        "modelAuthor": "samit.thange@dominodatalab.com"
    },
]

Register Model

This API registers a new model with DMM. It takes a valid Model Config JSON file as input.

Request Format:

POST  `/api/v0/models/register_model`

Sample request:

curl --location --request POST 'https://develop.dmm.domino.tech/api/v0/models/register_model' \
--header 'Authorization: <DMM-API-TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
        "dataType": "tabular",
        "dataColumns": [
                {
                        "name": "age",
                        "valueType": "numerical",
                        "isFeature": true,
                        "binsNum": 4
                },
                {
                        "name": "y",
                        "valueType": "categorical",
                        "isPrediction": true
                },
                {
                        "name": "RowId",
                        "valueType": "string",
                        "isRowIdentifier": true
                }
        ],
        "dataLocation": "https://s3.ap-south-1.amazonaws.com/dmm-shared-bucket/BMAF-TrainingData-DivTests.csv",
        "modelType": "classification",
        "modelMetadata": {
                "name": "API-Test",
                "modelVersion": "1",
                "dateCreated": "2020-04-17T08:11:12",
                "dataset": "BMAF-TrainingData-Webinar",
                "description": "API tests",
                "author": "samit.demo@dominodatalab.com"
        }
}'

Sample Response:

{
    "id": "5ec541a54ec87ed79851d121",
    "name": "API-Test",
    "modelType": "classification",
    "modelVersion": "1",
    "description": "API tests",
    "dateRegistered": "2020-05-20T14:41:41.448000",
    "modelAuthor": "samit.demo@dominodatalab.com"
}

Add Prediction Data

This API adds prediction data to a model.

Request Format:

PUT  `/api/v0/models/<modelID>/add_predictions`

Sample Request:

curl --location --request PUT 'https://develop.dmm.domino.tech/api/v0/models/5ec541a54ec87ed79851d121/add_predictions' \
--header 'Authorization: <DMM-API-TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "dataLocation": "https://s3.ap-south-1.amazonaws.com/dmm-shared-bucket/BMAF-Predictions-DivTests.csv"
}'

Sample Response:

{
    "status": "success"
}

Add Ground Truth Data

This API adds Ground Truth data to a model.

Request Format:

PUT  `/api/v0/models/<modelID>/add_ground_truths`

Sample Request:

curl --location --request PUT 'https://develop.dmm.domino.tech/api/v0/models/5ec541a54ec87ed79851d121/add_ground_truths' \
--header 'Authorization: <DMM-API-TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "dataColumns": [
    {
      "valueType": "categorical",
      "isGroundTruth": true,
      "forPredictionOutput": "y",
      "name": "y_gt"
    }
  ],
  "dataLocation": "https://s3.ap-south-1.amazonaws.com/dmm-shared-bucket/BMAF-GTLabels-DivTests.csv"
}'

Sample Response:

{
    "status": "success"
}

Unregister Model

This API unregisters the model from DMM.

Request Format:

DELETE  `/api/v0/models/<modelID>`

Sample request:

curl --location --request DELETE 'https://develop.dmm.domino.tech/api/v0/models/5ec541a54ec87ed79851d121' \
--header 'Authorization: <DMM-API-TOKEN>' \
--data-raw ''

Sample Response:

{
    "status": "success"
}