Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAPI to infer from a model using provided dataset by reference


HTTP RequestValue
Method

POSTGET

Header

Authorization: Bearer {token}

URL

{prefix}/models/{modelID}

Query Parameters

{

  "dbToken": "string";
  "modelIDaction": "string",
  "data":{
      "sourceType":"string",
      "endpoint":"string",
      "bearerToken":"string",
      "query":"string"
  }
}

Example

{

  "dbToken": "D41C4A382C27A4B5DF824E2D4F148";
  "modelIDaction": "6d4b571a-80ca-41ef-bc67-b158f4352ad8"infer",
  "data":{
      "sourceType":"snowflake",
      "endpoint":"some/endpoint",
      "bearerToken":"7CA4D3C152646DDEFB527A958C45B",
      "query":"SELECT foo FROM bar WHERE baz"
  }
}



Query Parameters

Pass by value is recommended only for small data set 

Expand
HTTP RequestValue
Method

POST

Header

Authorization: Bearer {token}

URL

{prefix}/models/

titleAPI to infer from a model using provided dataset by value
200: Prediction returned successfully by reference


dbTokenstring;modelID":"string"
  "data"   string   string   string  string

{

  "dbToken": "D41C4A382C27A4B5DF824E2D4F148";
  "modelID":"6d4b571a-80ca-41ef-bc67-b158f4352ad8"
HTTP ResponseValue
HeaderContent-Type: application/json
Body{
  "
resultStatus": "ready",
  "
result":{
   
"sourceType":"snowflake",
   
"endpoint":"some/endpoint",
   
"bearerToken":"7CA4D3C152646DDEFB527A958C45B",
    "query":"SELECT * FROM resultTable"
  }

}
Example



Expand
titleAPI to infer from a model using provided dataset by value

Pass by value is recommended only for small data set 

HTTP RequestValue
Method

GET

Header

Authorization: Bearer {token}

URL

{prefix}/models/model/{modelID}

Query Parameters

{
  "action": "string",
  "data":{
      "sourceType":"snowflakestring",
      "endpoint":"some/endpointstring",
      "bearerToken":"7CA4D3C152646DDEFB527A958C45Bstring",
      "query":"SELECT foo FROM bar WHERE bazstring"
  }
}

Example


{
  "action": "infer",
  "data":[
    { 
      "AccountBalance": 100,
      "YearOpened": 1990
    },
    { 
      "AccountBalance": 200,
      "YearOpened": 1995
    },
  ]

}





Expand
title200: Prediction returned successfully by value


HTTP ResponseValue
HeaderContent-Type: application/json
Body{
  "resultStatus": "ready",
  "result":[

    { 
      "AccountBalance": 100,
      "YearOpened": 1990,
      "Churn": 80
    },
    { 
      "AccountBalance": 200,
      "YearOpened": 1995,
      "Churn": 40
    },
  ]

}



Expand
title200: Prediction is running and not ready yet


HTTP ResponseValue
HeaderContent-Type: application/json
Body{
  "resultStatus": "notReady",
  "resultProgress": 50,
  "resultID": "925D2129FC57FAC5"
}


6. AI will connect to the underlying data source and run the prediction using the information provided by BI

7. In case the result cannot be returned immediately because of the prediction volume, BI can poll for the result.

In case of pass by reference

Code Block
languagejs
firstline1
titleGET {prefix}/results/925D2129FC57FAC5
collapsetrue
{
  "resultStatus": "ready",
  "result":{
    "sourceType":"snowflake",
    "endpoint":"some/endpoint",
    "bearerToken":"7CA4D3C152646DDEFB527A958C45B",
    "query":"SELECT * FROM resultTable"
  }
}

In case of pass by value:

Code Block
languagejs
firstline1
titleGET {prefix}/results/925D2129FC57FAC5
collapsetrue
{
  "resultStatus": "ready",
  "result":[
    { 
      "AccountBalance": 100,
      "YearOpened": 1990,
      "Churn": 80
    },
    { 
      "AccountBalance": 200,
      "YearOpened": 1995,
      "Churn": 40
    },
  ]
}

Error - Apply to all API calls above

...