Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!

Qlik AutoML: How to test API realtime-predictions from Postman?

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
KellyHobson
Former Employee
Former Employee

Qlik AutoML: How to test API realtime-predictions from Postman?

Last Update:

Oct 24, 2022 5:25:48 AM

Updated By:

Sonja_Bauernfeind

Created date:

Oct 14, 2022 12:17:48 PM

In this article, I will outline the steps to POST an API call to realtime-predictions and return a response. The main purpose of the API is to send records to predict against an already deployed model in Qlik AutoML.

This is an example with the iris.csv dataset used commonly in data science examples. Variety is the target variable.

 

Steps

  1. Upload, train and deploy model for iris.csv.  See this article for steps on how to deploy a model. 

    XGBoost Classification was the champion model which I choose to deploy.

    deployedmodel.png

  2. Generate an API key. Copy this information for later steps. 
  3. Open the Deployed model and navigate to the Real-time predictions tab

    deployemodel_realtimepreds.png

  4. Copy the Realtime-predictions URL to a safe place

    copyurl_3.png

  5. Open a new Postman collection and set as a POST request

    postman1.png

  6. In the request URL, enter the realtime-predictions URL from step #3

    postman2.png

  7. Under the Headers Tab, add your API key as an 'Authorization' key with the format "Bearer valuefromstep#2"

    postman3.png

  8. Under the Body section enter the following JSON

    {"rows":[ [5.4,3.1,1.7,0.5], [4.4,3.4,1.2,0.4]],

    "schema": [
    {"name": "sepal.length"},
    {"name": "sepal.width"},
    {"name": "petal.length"},
    {"name": "petal.width"}]


    }

    Where rows represent new records you would like to score the deployed model against and get a predicted variety back from.

    Schema represents the 4 features used to train the model.

  9. Click Send in the Postman application

    postman4.png

    This will return a JSON payload with the predicted values

    postman5.png

    Note, if you would like the return to be sent back as a csv (easier readability), then add the following Header -> Accept : text/csv

    postman6.png

    Then you can see the variety Predicted in addition to the predicted probabilities of the other types.

    postman7.png

 

 

 


Conclusion

In this article, we are generating predictions on a small number of records and this is meant to serve as an example on how to interact with the API.

This is based on the API developers documentation.

 

Coming soon....

We will document similar steps using Python instead of Postman and link to this article. 

 

Environment

 

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

 

Labels (1)
Version history
Last update:
‎2022-10-24 05:25 AM
Updated by: