Running deployed API's test queries without the API Deployer

Sunny
Sunny Registered Posts: 6

Hi,

Is there a way to run all the test queries of the deployed API's using python script.

Answers

  • JordanB
    JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 297 Dataiker
    edited July 17

    Hi @Sunny
    ,

    Unfortunately, that functionality is not included in DSS Python API's natively. You would need to create a python script with the entry point to the API node and define your test queries there (ref: https://doc.dataiku.com/dss/latest/apinode/api/user-api.html#dataikuapi.APINodeClient

    import dataikuapi
    
    client = dataikuapi.APINodeClient("http:<uri>", "<service-id>")
    
    record_to_predict = {
        "item1": "example",
        "item2": 415,
    }
    prediction = client.predict_record("<endpoint-id>", record_to_predict)
    print(prediction["result"])

    Let me know if you have any questions.

    Thanks!

    Jordan

Setup Info
    Tags
      Help me…