API Guide
API Endpoint
The API endpoint is located at
http://core.xdeep.io/run_model
Request Method
This API uses the HTTP GET method to retrieve model results.
Request Parameters
model_id(required): This parameter specifies the ID of the model you want to execute. You need to replace “ID” with the actual model ID that you want to use.data(required): This parameter is used to provide the input vector for the model. It should be a list of numerical values enclosed in square brackets. Please note that thedatavector should consist of comma (,) separated numerical values with the dot (.) as the decimal separator. There should be no thousands separator used in the values provided.
Example Request
GET http://core.xdeep.io/run_model?model_id=YOUR_MODEL_ID&data=[0.96331,-4.84262, ...]
Response Format
The API returns a JSON response with the following structure:
{
"code": 1,
"message": "Model (ID) was executed successfully",
"model_response": [Model result]
}
Response Fields
code: An integer value indicating the status of the request.1: indicates a successful execution of the model.0: indicates an error, and the “message” field will provide information about the error.
message: A string that provides information about the result of the API call. If there is an error, this field will explain the nature of the error.model_response(only in case of success): This field contains the result produced by the model.
Modeling Multiple Outputs
For Xdeep models, the model_response is designed to be a single numerical value, as Xdeep models are primarily single output models. If you have a problem that involves multiple outputs, we recommend modeling each output as a separate model within the Xdeep platform.
This approach allows you to effectively model and retrieve results for each individual output, ensuring clarity and simplicity in the API’s design. You can execute these individual models independently and obtain their respective results.
By modeling each output as a separate model, you can maintain the integrity of the API’s single numerical value response structure while addressing complex problems with multiple outputs.
Error Responses
code field in the response will be 0, and the message field will explain the nature of the error. Here are the possible error messages:- Error: Model Does Not Exist
{
"code": 0,
"message": "Model (X) does not exist"
}
This error occurs when the model with ID X does not exist in the system - Error: Model Not Published
{
"code": 0,
"message": "Model (X) is not published"
}
This error occurs when the model with ID X exists but is not published, and therefore cannot be executed. - Error: Numerical Data Error
{
"code": 0,
"message": "Numerical error in provided data or data object"
}
This error occurs when thedataparameter does not contain valid numerical values. - Error: No Data Provided
{
"code": 0,
"message": "No valid data or data object is provided"}
This error occurs when thedataparameter is missing or empty.
Usage Guidelines
- Ensure that you have the correct
model_idfor the model you want to execute. - Check that the
dataparameter is correctly formatted and contains valid numerical values. - Handle error responses appropriately by checking the
codefield and the error message in themessagefield. - Use the
model_responsefield to access the results produced by the model when the API call is successful.
