MLServices endpoint
An MLService is a published trained model that provides your organization with the ability to access and reuse previously developed models. A key feature of MLServices is the ability to automate training and scoring on a scheduled basis. Scheduled training runs can help upkeep a model’s efficiency and accuracy, while scheduled scoring runs can ensure that new insights are consistently generated.
Automated training and scoring schedules are defined with a starting timestamp, ending timestamp, and a frequency represented as a . Schedules can be defined when creating an MLService or applied by updating an existing MLService.
Create an MLService create-an-mlservice
You can create an MLService by performing a POST request and a payload that provides a name for the service and a valid MLInstance ID. The MLInstance used to create an MLService is not required to have existing training Experiments but you can choose to create the MLService with an existing trained model by providing the corresponding Experiment ID and training run ID.
API Format
POST /mlServices
Request
curl -X POST \
https://platform.adobe.io/data/sensei/mlServices \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'content-type: application/vnd.adobe.platform.sensei+json; profile=mlService.v1.json' \
-d '{
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingExperimentRunId": "33408593-2871-4198-a812-6d1b7d939cda",
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
}
}'
name
description
mlInstanceId
trainingDataSetId
trainingExperimentId
trainingExperimentRunId
trainingSchedule
trainingSchedule.startTime
trainingSchedule.endTime
trainingSchedule.cron
scoringSchedule
scoringSchedule.startTime
scoringSchedule.endTime
scoringSchedule.cron
Response
A successful response returns a payload containing the details of the newly created MLService including its unique identifier (id
), Experiment ID for training (trainingExperimentId
), Experiment ID for scoring (scoringExperimentId
), and the input training dataset ID (trainingDataSetId
).
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@ÃÛ¶¹ÊÓƵID"
},
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"updated": "2019-01-01T00:00:00.000Z"
}
Retrieve a list of MLServices retrieve-a-list-of-mlservices
You can retrieve a list of MLServices by performing a single GET request. To help filter results, you can specify query parameters in the request path. For a list of available queries, refer to the appendix section on query parameters for asset retrieval.
API Format
GET /mlServices
GET /mlServices?{QUERY_PARAMETER}={VALUE}
GET /mlServices?{QUERY_PARAMETER_1}={VALUE_1}&{QUERY_PARAMETER_2}={VALUE_2}
{QUERY_PARAMETER}
{VALUE}
Request
The following request contains a query and retrieves a list of MLServices sharing the same MLInstance ID ({MLINSTANCE_ID}
).
curl -X GET \
'https://platform.adobe.io/data/sensei/mlServices?property=mlInstanceId==46986c8f-7739-4376-8509-0178bdf32cda' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
A successful response returns a list of MLServices and their details including their MLService ID ({MLSERVICE_ID}
), Experiment ID for training ({TRAINING_ID}
), Experiment ID for scoring ({SCORING_ID}
), and the input training dataset ID ({DATASET_ID}
).
{
"children": [
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A service created in UI",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"displayName": "Jane Doe",
"userId": "Jane_Doe@ÃÛ¶¹ÊÓƵID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
],
"_page": {
"property": "mlInstanceId==46986c8f-7739-4376-8509-0178bdf32cda,deleted==false",
"count": 1
}
}
Retrieve a specific MLService retrieve-a-specific-mlservice
You can retrieve the details of a specific Experiment by performing a GET request that includes the desired MLService’s ID in the request path.
API Format
GET /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
: A valid MLService ID.
Request
curl -X GET \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
A successful response returns a payload containing the details of the requested MLService.
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@ÃÛ¶¹ÊÓƵID"
},
"updated": "2019-01-01T00:00:00.000Z"
}
Update an MLService update-an-mlservice
You can update an existing MLService by overwriting its properties through a PUT request that includes the target MLService’s ID in the request path and providing a JSON payload containing updated properties.
API Format
PUT /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
: A valid MLService ID.
Request
curl -X PUT \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}' \
-H 'content-type: application/vnd.adobe.platform.sensei+json; profile=mlService.v1.json' \
-d '{
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
}
}'
Response
A successful response returns a payload containing the MLService’s updated details.
{
"id": "68d936d8-17e6-44ef-a4b6-c7502055638b",
"name": "A name for this MLService",
"description": "A description for this MLService",
"mlInstanceId": "46986c8f-7739-4376-8509-0178bdf32cda",
"trainingExperimentId": "014d8acf-08fb-421c-8b65-760c8799c627",
"trainingDataSetId": "5ee3cd7f2d34011913c56941",
"scoringExperimentId": "76c2b1b-fad7-4b31-8c54-19ecc18b1ea0",
"created": "2019-01-01T00:00:00.000Z",
"createdBy": {
"userId": "Jane_Doe@ÃÛ¶¹ÊÓƵID"
},
"trainingSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"scoringSchedule": {
"startTime": "2019-01-01T00:00",
"endTime": "2019-12-31T00:00",
"cron": "20 * * * *"
},
"updated": "2019-01-02T00:00:00.000Z"
}
Delete an MLService
You can delete a single MLService by performing a DELETE request that includes the target MLService’s ID in the request path.
API Format
DELETE /mlServices/{MLSERVICE_ID}
{MLSERVICE_ID}
Request
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlServices/68d936d8-17e6-44ef-a4b6-c7502055638b \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
{
"title": "Success",
"status": 200,
"detail": "MLService deletion was successful"
}
Delete MLServices by MLInstance ID
You can delete all MLServices belonging to a particular MLInstance by performing a DELETE request that specifies an MLInstance ID as a query parameter.
API Format
DELETE /mlServices?mlInstanceId={MLINSTANCE_ID}
{MLINSTANCE_ID}
Request
curl -X DELETE \
https://platform.adobe.io/data/sensei/mlServices?mlInstanceId=46986c8f-7739-4376-8509-0178bdf32cda \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'x-api-key: {API_KEY}' \
-H 'x-gw-ims-org-id: {ORG_ID}' \
-H 'x-sandbox-name: {SANDBOX_NAME}'
Response
{
"title": "Success",
"status": 200,
"detail": "MLServices deletion was successful"
}