Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Receiving a response
Upon successful execution of the API request, you will receive a response containing the prediction results or any relevant information based on the model and data provided. The format and structure of the response will vary depending on the specific model and endpoint used.
This is a Timeseries period prediction example:
The response contains a single key-value pair:
"data"
: The key "data"
maps to an array of objects that represents the prediction results or relevant information.
Make sure to handle the response appropriately in your code to process the prediction results or handle any potential errors returned by the API. More about structure on next section.
JSON request structures for various models
Binary classification, Regression, Multiclass classification
The following models have similar JSON structure: Binary classification, Logistic regression, Multiclass classification
JSON structure represents a data object with a key "data" mapping to an array called "predict_values". The "predict_values" array contains multiple elements, each representing a set of data. Each set of data is represented as an array of objects. Each object within the array represents a key-value pair, where required "alias" is the key and required "selectedValue" is the corresponding value. The keys "Lead Source", "Lead Origin", and "Converted" are common in each object, but their values differ, representing different attributes or properties of the data. Timeseries model
JSON structure represents a data object with a key "data" mapping to an object called "predict_values". The "predict_values" object contains three key-value pairs. The required keys are "startDate", "endDate", and "sequenceID", and their corresponding values are "2023-04-17", "2023-04-18", and "A" respectively.
Start your interaction with Graphite API
To interact with the Graphite Note API and perform predictions using a specific model, you need to make a POST request to the API endpoint. The following code snippet demonstrates how to make such a request using cURL - command line tool and a library that allows you to transfer data using various protocols, including HTTP, HTTPS.
In the following sections, you will find more details about the Prediction API.
The request requires the following headers to be included:
Authorization
: This header should be set to "Bearer [token]
". Replace [token]
with your unique token. The token can be found by accessing the account info page in the Graphite Note app, under the section displaying your current plan information.
Content-Type
: This header should be set to "application/json" to indicate that the request payload is in JSON format.
Necessary information to make a request to an API endpoint for the Graphite Note application
The base URL for the API endpoint is:
Replace [model-code]
in the URL with the code of the specific model you want to use for predictions.
To easily find the [model-code]
, open the specific model and navigate to the Settings tab. The model code can be found in the ID section.
JSON response structures for various models
Binary classification, Regression, Multiclass classification
The following models have similar JSON structure: Binary classification, Logistic regression, Multiclass classification
The JSON structure consists of a root object with a key-value pair, where the key is "data" and the value is an object containing two keys: "columns" and "data".
"data"
: This key maps to an array of data objects. Each data object within the array represents a specific entry or prediction result. In this example, there are two data objects.
Each data object contains key-value pairs representing the column names and their corresponding values. For example, the first data object has the values "NO", "API", "bing", 0.935, 0.065, and "1" for the keys "Label", "Lead Origin", "Lead Source", "Score_NO", "Score_YES", and "Total Time Spent on Website", respectively.
The second data object follows a similar pattern, with different values for each key.
"columns"
: This key maps to an array of column names. In this example, the array contains three column names: "Total Time Spent on Website", "Lead Origin", and "Lead Source". These column names define the fields or attributes associated with each data entry.
Timeseries model
The JSON structure consists of a root object with a key-value pair, where the key is "data" and the value is an array. The array contains three elements representing different pieces of information. Last element in data array(sequenceID) is directly related to "sequenceID" sent in request, and the number of other elements depends on date difference sent in request.
"date"
and "predicted"
: The first two elements within the "data" array represent specific dates and their corresponding predicted values. Each element is an object with two key-value pairs: "date" and "predicted". The "date" represents a specific date and time in ISO 8601 format, and the "predicted" holds the corresponding predicted value for that date. In the given example, the predicted values for the dates "2023-04-17T00:00:00.000Z" and "2023-04-18T00:00:00.000Z" are 40.4385672276 and 41.1831442568, respectively.
"sequenceID"
: The third element within the "data" array represents the sequence ID. It is an object with a single key-value pair: "sequenceID" and its corresponding value. In this example, the sequence ID is represented as "A". If your dataset includes multiple time series sequences, you should choose a field that uniquely identifies each sequence (e.g., product ID, store ID, etc.). This will allow Graphite Note to generate independent forecasts for each individual time series. We don't allow fields with too many sequences (unique values) here.
This JSON structure is used to convey the predicted values for different dates in a Tmeseries model. Each date is associated with its predicted value, and the sequence ID provides additional context or identification for the timeseries data.
Graphite enforces rate limits for API requests to ensure fair usage and prevent abuse. The system utilizes two levels of rate limiting: global and tenant-specific.
The system monitors overall API traffic to count the number of requests made within the last minute. If this count exceeds the configured global rate limit, further API requests are denied.
Additionally, the system tracks API usage on a per-tenant basis. If the count of API requests made by the current tenant within the last minute surpasses the specified rate limit, further API requests are denied.
The rate limits are configured as followed:
Note: Rate Limit Exceeded
When the API rate limit is reached, the system will deny further requests, and the API response should include the HTTP status code
429 (Too Many Requests)
. This status code indicates that the client has made too many requests within a specified time frame. It is essential for clients to handle this response code gracefully by adjusting their request frequency or implementing backoff strategies