Interact with the API
Promote offers a series of API endpoints that allow you to interact with your Promote models using a remote Bash terminal (for Windows users, we recommend Git Bash):
Authentication Requirements
Before you can interact with the API endpoints, you must acquire an access token from Promote:
# Replace "MANAGER" with the IP address of your manager node. # Replace "USERNAME" with your Promote username. # Replace "PASSWORD" with your Promote password. curl 'http://MANAGER/api/login' -H 'Content-Type: application/json' --data '{"username":"USERNAME","password":"PASSWORD"}'
Promote returns an access token. Keep it someplace secure, because you need it to request information from the API endpoints.
List Model Names
Make the Promote API return the names of the models it hosts:
# Replace "ACCESS_TOKEN" with the access token Promote provided to you. # Replace "MANAGER" with the IP address of your manager server. curl -X GET -H "Content-Type: application/json" -H 'Authorization: Bearer ACCESS_TOKEN' https://MANAGER/api/models
See Model Versions
Make the Promote API return the versions of the models it hosts:
# Replace "ACCESS_TOKEN" with the access token Promote provided to you. # Replace "MANAGER" with the IP address of your manager server. # Replace "USERNAME" with your Promote username. # Replace "MODELNAME" with the name of the Promote model. curl -X GET -H "Content-Type: application/json" -H 'Authorization: Bearer ACCESS_TOKEN' http://MANAGER/api/models/USERNAME/MODELNAME/info
Report Model Uptime and Status
Make the Promote API return information about the uptimes and statuses of your models:
# Replace "ACCESS_TOKEN" with the access token Promote provided to you. # Replace "MANAGER" with the IP address of your manager server. # Replace "USERNAME" with your Promote username. # Replace "MODELNAME" with the name of your Promote model. curl -X GET -H "Content-Type: application/json" -H 'Authorization: Bearer ACCESS_TOKEN' http://MANAGER/USERNAME/models/MODELNAME/info
Get Promote System Information
Make the Promote API return information about the status of your system:
# Replace "ACCESS_TOKEN" with the access token Promote provided to you. # Replace "MANAGER" with the IP address of your manager server curl -X GET -H "Content-Type: application/json" -H 'Authorization: Bearer ACCESS_TOKEN' http://MANAGER/api/metrics
Post Predictions
Have the Promote API make a prediction based on data you provide:
# Replace "USERNAME" with your Promote username, "APIKEY" your Promote API key. # Replace "{JSON: DATA}" with your data in JSON format. # Replace "MANAGER" with the IP address of your manager server. # Replace "MODELNAME" with the name of the model you want to query curl -X POST -H "Content-Type: application/json" --user USERNAME:APIKEY --data '{JSON: DATA}' http://MANAGER/USERNAME/models/MODELNAME/predict
注記
You may request predictions from Promote without a token. Promote still requires an API key.