Interact with the API

Version:
2019.3
Last modified: October 09, 2019

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:

Bash
  1. # Replace "MANAGER" with the IP address of your manager node. 
  2. # Replace "USERNAME" with your Promote username. 
  3. # Replace "PASSWORD" with your Promote password.
  4.  
  5. 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:

Bash
  1. # Replace "ACCESS_TOKEN" with the access token Promote provided to you. 
  2. # Replace "MANAGER" with the IP address of your manager server.
  3.  
  4. 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:

Bash
  1. # Replace "ACCESS_TOKEN" with the access token Promote provided to you. 
  2. # Replace "MANAGER" with the IP address of your manager server. 
  3. # Replace "USERNAME" with your Promote username. 
  4. # Replace "MODELNAME" with the name of the Promote model.
  5.  
  6. 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:

Bash
  1. # Replace "ACCESS_TOKEN" with the access token Promote provided to you. 
  2. # Replace "MANAGER" with the IP address of your manager server. 
  3. # Replace "USERNAME" with your Promote username. 
  4. # Replace "MODELNAME" with the name of your Promote model.
  5.  
  6. 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:

Bash
  1. # Replace "ACCESS_TOKEN" with the access token Promote provided to you. 
  2. # Replace "MANAGER" with the IP address of your manager server
  3.  
  4. 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:

Bash
  1. # Replace "USERNAME" with your Promote username, "APIKEY" your Promote API key.
  2. # Replace "{JSON: DATA}" with your data in JSON format. 
  3. # Replace "MANAGER" with the IP address of your manager server. 
  4. # Replace "MODELNAME" with the name of the model you want to query
  5.  
  6. 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.

 

Was This Helpful?

Need something else? Visit the Alteryx Community or contact support.