Introduction to RASON
About RASON Models and the RASON Server
Rason Subscriptions
Rason Web IDE
Creating and Running a Decision Flow
Defining Your Optimization Model
Defining Your Simulation Model
Performing Sensitivity Analysis
Defining Your Stochastic Optimization Model
Defining Your Data Science Model
Defining Custom Types
Defining Custom Functions
Defining Your Decision Table
Defining Contexts
Using the REST API
REST API Quick Call Endpoints
REST API Endpoints
Decision Flow REST API Endpoints
OData Endpoints
OData Service for Decision Flows
Creating Your Own Application
Using Arrays, For, Loops and Tables
Organization Accounts

REST Endpoint: GET: https://rason.net/api/model/{nameorid}

A REST API endpoint that creates an unnamed or named resource ID for

  • a RASON model,
  • an Excel optimization/simulation/decision table/data science model,
  • data science fitted model (RASON or PMML)

and returns a Location header with the resource ID. If "modelName":"myModelName" exists in the body of the RASON model or if the model name is appended to this endpoint (POST https://rason.net/api/model/{myModelName}), then this REST API endpoint will create a named resource. The model, "myModelName", must be a RASON model and not a fitted model. Model names are case sensitive.

The returned model ID URL facilitates subsequent calls to the RASON REST API endpoints necessary for manipulating your model (i.e. perform an optimization, run a simulation, check the status of the model, get results, etc.).

Note: When using this endpoint to post and solve an Excel model, the Excel model is uploaded and stored on the Rason Server.

Below is a brief explanation of the returned properties

  • modelID: The unique identifier for the model
  • modelName: The name of the model taken from the model text. When using POST rason.net/api/model/>name< the name from the url is validated against the name in the model, if specified.
  • modelDescr: The model description taken directly from the model text
  • modelFiles: The list of files used by the model as taken from the model text.
  • runtimeToken: Lists any runtime token associated with this model
  • modelType: Lists the type of model such as "origin", "version", "instance".
    • “origin" – the initially posted model
    • "version" - means that this model is a version of a previously POSTed or PUT model
    • “instance” – these are models created whenever a model is run
  • modelKind: Lists the kind of model such as "fitted", "excel" or "rason".
    • “fitted” – fitted Data Science model in PMML/JSON format
    • “excel” – models defined in Excel language
    • “rason” – models defined in RASON language
  • isChampion: True only if model has been specifically marked as the “Champion” using the REST API endpoint PATCH rason.net/api/model/{nameorid}.
  • parentModelId: Identifies the model from which this model is derived. In the case of “Origin” models, this is always empty. Otherwise, this property identifies the model used to create this model. For example, if a user POST’s a model and then PUT’s another version of this model, "parentModelId" of the version will be the modelId of the originally posted model. Similar logic holds for posting versions of version and instances of version.
  • queryString: The query string associated with the model when it was created. In the case of unnamed models, this will change throughout the model’s lifecycle. A user may post an unnamed model with a particular query string but then solve the model with another. In the case of named models, this is the query string associated with the action used to create the model. A model could be posted with one query string, have several versions with different query strings and associated instances with yet another query string. If a particular version or instance doesn’t have a query string, it will inherit the query string of the parent.
  • URL:https://rason.net/api/model/{nameorid}
  • Method: GET
  • URL Params

    Required: None

    Optional: None

  • Headers:

    Required: Authorization - Example: Authorization: bearer {your RASON token}

    Optional: None

  • Data Params: None
  • Success Response

    Code: 200 (OK)

    • Example Request: https://rason.net/api/model/StratifiedSampling

      Example Response:

              
            {
              "modelName": "StratifiedSampling",
              "modelDescription": "transformation: stratified sampling",
              "modelType": "datamining",
                "datasources": {
                  "mySrc": {
                    "type": "csv",
                    "connection": "hald-small-binary.txt",
                    "direction": "import"
                  }
                },
                "datasets": {
                  "myData": {
                    "binding": "mySrc",
                    "strataCol": "Y"
                  }
                },
                "transformer": {
                  "mySampler": {
                    "type": "transformation",
                    "algorithm": "stratifiedSampling",
                    "parameters": {
                    "sampleSize": 10,
                    "replaceOption": false,
                    "sortIndexes": false,
                    "seed": 123,
                    "StratificationMethod": "PROPORTIONAL"
                  }
                }
              },
              "actions": {
                "sampleData": {
                  "data": "myData",
                  "action": "transform",
                  "evaluations": [
                    "transformation"
                  ]
                }
              }
            }
              
            
    • https://rason.net/api/model/{modelorid}?type={origin, version, instance or all}

      • Example Request: https://rason.net/api/model/DecisionTreeClassification?type=origin

        Example Response:

                      
                  [
                    {
                      "ModelId": "2590+DecisionTreeClassification+2020-05-28-21-48-35-064322",
                      "ModelName": "DecisionTreeClassification",
                      "ModelDescr": "classification: decision tree",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small-binary-train.txt",
                          "isOnServer": false
                        },
                        {
                          "fileName": "hald-small-binary-valid.txt",
                          "isOnServer": false
                        },
                        {
                          "fileName": "classification-decision-tree.xml",
                          "isOnServer": false
                        },
                        {
                          "fileName": "classification-decision-tree.json",
                          "isOnServer": false
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Origin",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": null,
                      "QueryString": ""
                     }
                   ]
                      
                    
      • Example Request: https://rason.net/api/model/mlrDF?type=version

        Example Response:

                      
                  [
                    {
                      "ModelId": "2590+mlrDF+2020-05-21-01-12-10-082250",
                      "ModelName": "mlrDF",
                      "ModelDescr": "DF that partitions a dataset into three partitions, rescales the partitions and runs MLR",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small.txt",
                          "isOnServer": true
                        },
                        {
                          "fileName": "hald-small-unlabeled.txt",
                          "isOnServer": true
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Version",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": "2590+mlrDF+2020-05-21-01-10-23-882710",
                      "QueryString": "keep-intermediate-results=true&data-storage=JSON"
                    }
                  ]
                      
                    
      • Example Request: https://rason.net/api/model/LogisticRegression?type=instance

        Example Response:

                      
                  [
                    {
                      "ModelId": "2590+LogisticRegression+2020-05-28-21-07-59-763658",
                      "ModelName": "LogisticRegression",
                      "ModelDescr": "classification: logistic regression; scoring example PMMLClassifie
                      r.json uses exported fitted model, lrModel, to score new data",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small-binary-train.txt",
                          "isOnServer": false
                        },
                        {
                          "fileName": "hald-small-binary-valid.txt",
                          "isOnServer": false
                        },
                        {
                          "fileName": "classification-logistic-model.xml",
                          "isOnServer": false
                        },
                        {
                          "fileName": "classification-logistic-model.json",
                          "isOnServer": false
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Instance",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": "2590+LogisticRegression+2020-05-28-21-04-19-737715",
                      "QueryString": "response-format=STANDALONE"
                    }
                  ]
                      
                    
      • Example Request: https://rason.net/api/model/mlrDF?type=all

        Example Response:

                      
                  [
                    {
                      "ModelId": "2590+mlrDF+2020-05-21-01-12-18-469787",
                      "ModelName": "mlrDF",
                      "ModelDescr": "DF that partitions a dataset into three partitions, rescales th
                      e partitions and runs MLR",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small.txt",
                          "isOnServer": true
                        },
                        {
                          "fileName": "hald-small-unlabeled.txt",
                          "isOnServer": true
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Instance",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": "2590+mlrDF+2020-05-21-01-12-10-082250",
                      "QueryString": "keep-intermediate-results=true&data-storage=JSON"
                    },
                    {
                      "ModelId": "2590+mlrDF+2020-05-21-01-12-10-082250",
                      "ModelName": "mlrDF",
                      "ModelDescr": "DF that partitions a dataset into three partitions, rescales th
                       e partitions and runs MLR",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small.txt",
                          "isOnServer": true
                        },
                        {
                          "fileName": "hald-small-unlabeled.txt",
                          "isOnServer": true
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Origin",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": "null",
                      "QueryString": "keep-intermediate-results=true&data-storage=JSON"
                    },
                    {
                      "ModelId": "2590+mlrDF+2020-05-19-22-20-06-803420",
                      "ModelName": "mlrDF",
                      "ModelDescr": "DF that partitions a dataset into three partitions, rescales the partitions and runs MLR",
                      "ModelFiles": [
                        {
                          "fileName": "hald-small.txt",
                          "isOnServer": true
                        },
                        {
                          "fileName": "hald-small-unlabeled.txt",
                          "isOnServer": true
                        }
                      ],
                      "RuntimeToken": "",
                      "ModelType": "Version",
                      "ModelKind": "Rason",
                      "IsChampion": false,
                      "ParentModelId": "2590+mlrDF+2020-05-21-01-12-10-082250",
                      "QueryString": ""
                      }
                    ]
                      
                    
    • https://rason.net/api/model/{modelorid}?kind={excel, rason, fitted or all}

      • Example Request: https://rason.net/api/model/BusinessForecastPsiInput?type=excel

        Note that this endpoint may also return an Excel model workbook as an attachment.

        Example Response:

                      
          {
            "comment": "This interface has been generated by Psi for an Excel model in the wor
                kbook BusinessForecastPsiInput.xlsx",
            "invokeModel": "BusinessForecastPsiInput:BusinessForecastPsiInput.xlsx!Forecast wi
                 th Uncertainty",
            "modelType": "simulation",
            "modelDescription": "",
            "inputParameters": {
                "J21:L21": {
                    "value": null,
                    "type": "array",
                    "comment": ""
                },
                "J17:L17": {
                    "value": null,
                    "type": "array",
                    "comment": ""
                }
            },
            "outputResults": {
                "g18": {
                    "evaluations": [
                        "trials",
                        "mean"
                    ],
                    "type": "array/number",
                    "comment": "distribution variable"
                },
                "k23": {
                    "evaluations": [
                        "trials",
                        "mean"
                    ],
                    "type": "array/number",
                    "comment": "distribution variable"
                },
                "f20": {
                    "evaluations": [
                        "mean"
                    ],
                    "type": "array/number",
                    "comment": "uncertain function"
                }
            }
        }
                        
                    
      • Example Request: https://rason.net/api/model/rescaling-reusable?type=rason

        Example Response:

                      
          {
            "modelName": "rescaling-reusable",
            "modelType": "datamining",
            "modelDescription": "transformation: rescaling",
            "inputParameters": {
                "trainData": {
                    "type": "dataset",
                    "value": null,
                    "comment": ""
                },
                "validData": {
                    "type": "dataset",
                    "value": null,
                    "comment": ""
                },
                "testData": {
                    "type": "dataset",
                    "value": null,
                    "comment": ""
                }
            },
            "datasources": {
                "newDataSource": {
                    "type": "csv",
                    "connection": "hald-small-unlabeled.txt"
                }
            },
            "datasets": {
                "newData": {
                    "binding": "newDataSource"
                }
            },
            "estimator": {
                "myRescaler": {
                    "type": "transformation",
                    "algorithm": "rescaling",
                    "parameters": {
                        "technique": "UNIT_NORMALIZATION",
                        "normType": "L1",
                        "excludedCols": [
                            "Y"
                        ]
                    }
                }
            },
            "actions": {
                "rescalerModel": {
                    "trainData": "trainData",
                    "estimator": "myRescaler",
                    "action": "fit",
                    "evaluations": [
                        "statistics"
                    ]
                },
                "rescaledTrainData": {
                    "data": "trainData",
                    "fittedModel": "rescalerModel",
                    "action": "transform",
                    "evaluations": [
                        "transformation"
                    ]
                },
                "rescaledValidData": {
                    "data": "validData",
                    "fittedModel": "rescalerModel",
                    "action": "transform",
                    "evaluations": [
                        "transformation"
                    ]
                },
                "rescaledTestData": {
                    "data": "testData",
                    "fittedModel": "rescalerModel",
                    "action": "transform",
                    "evaluations": [
                        "transformation"
                    ]
                },
                "rescaledNewData": {
                    "data": "newData",
                    "fittedModel": "rescalerModel",
                    "action": "transform",
                    "evaluations": [
                        "transformation"
                    ]
                }
            }
        }
                      
                    
      • Example Request: https://rasonrestapi2-test.azurewebsites.net/api/model/fitted-myjsonsrc?modelKind=fitted

        Example Response:

                      
          {
            "modelName": "BaggingClassification",
            "objectType": "fittedModel",
            "type": "classification",
            "algorithm": "bagging",
            "variables": [
                "X1",
                "X2",
                "X3",
                "X4",
                "Weights"
            ],
            "targetColumn": "Y",
            "categoricalVariables": {},
            "fittedModel": {
                "classes": {
                    "objectType": "stringVector",
                    "name": "StringVector",
                    "data": [
                        "0",
                        "1"
                    ]
                },
                "weakLearners": [
                    {
                        "modelName": "",
                        "objectType": "fittedModel",
                        "type": "classification",
                        "algorithm": "decisionTree",
                        "variables": [
                            "X1",
                            "X2",
                            "X3",
                            "X4",
                            "Weights"
                        ],
                        "targetColumn": "Y",
                        "categoricalVariables": {},
                        "fittedModel": {
                            "classes": {
                                "objectType": "stringVector",
                                "name": "StringVector",
                                "data": [
                                    "0",
                                    "1"
                                ]
                            },
                            "priorProb": {
                                "0": 0.46153846153846156,
                                "1": 0.53846153846153844
                            },
                            "root": {
                                "id": 0,
                                "score": 1,
                                "recordCount": 13,
                                "predicate": null,
                                "scoreDistribution": [
                                    {
                                        "category": "0",
                                        "recordCount": 6
                                    },
                                    {
                                        "category": "1",
                                        "recordCount": 7
                                    }
                                ],
                                "leftChild": {
                                    "id": 1,
                                    "score": 1,
                                    "recordCount": 8,
                                    "predicate": {
                                        "type": "continuous",
                                        "field": "X4",
                                        "operator": "less",
                                        "splitValue": 36.5
                                    },
                                    "scoreDistribution": [
                                        {
                                            "category": "0",
                                            "recordCount": 1
                                        },
                                        {
                                            "category": "1",
                                            "recordCount": 7
                                        }
                                    ],
                                    "leftChild": {
                                        "id": 3,
                                        "score": 0,
                                        "recordCount": 1,
                                        "predicate": {
                                            "type": "continuous",
                                            "field": "X1",
                                            "operator": "less",
                                            "splitValue": 2.5
                                        },
                                        "scoreDistribution": [
                                            {
                                                "category": "0",
                                                "recordCount": 1
                                            },
                                            {
                                                "category": "1",
                                                "recordCount": 0
                                            }
                                        ]
                                    },
                                    "rightChild": {
                                        "id": 4,
                                        "score": 1,
                                        "recordCount": 7,
                                        "predicate": {
                                            "type": "continuous",
                                            "field": "X1",
                                            "operator": "greaterOrEqual",
                                            "splitValue": 2.5
                                        },
                                        "scoreDistribution": [
                                            {
                                                "category": "0",
                                                "recordCount": 0
                                            },
                                            {
                                                "category": "1",
                                                "recordCount": 7
                                            }
                                        ]
                                    }
                                },
                                "rightChild": {
                                    "id": 2,
                                    "score": 0,
                                    "recordCount": 5,
                                    "predicate": {
                                        "type": "continuous",
                                        "field": "X4",
                                        "operator": "greaterOrEqual",
                                        "splitValue": 36.5
                                    },
                                    "scoreDistribution": [
                                        {
                                            "category": "0",
                                            "recordCount": 5
                                        },
                                        {
                                            "category": "1",
                                            "recordCount": 0
                                        }
                                    ]
                                }
                            },
                            "successClass": "1"
                        }
                    },
                    {
                        "modelName": "",
                        "objectType": "fittedModel",
                        "type": "classification",
                        "algorithm": "decisionTree",
                        "variables": [
                            "X1",
                            "X2",
                            "X3",
                            "X4",
                            "Weights"
                        ],
                        "targetColumn": "Y",
                        "categoricalVariables": {},
                        "fittedModel": {
                            "classes": {
                                "objectType": "stringVector",
                                "name": "StringVector",
                                "data": [
                                    "0",
                                    "1"
                                ]
                            },
                            "priorProb": {
                                "0": 0.61538461538461542,
                                "1": 0.38461538461538464
                            },
                            "root": {
                                "id": 0,
                                "score": 0,
                                "recordCount": 13,
                                "predicate": null,
                                "scoreDistribution": [
                                    {
                                        "category": "0",
                                        "recordCount": 8
                                    },
                                    {
                                        "category": "1",
                                        "recordCount": 5
                                    }
                                ],
                                "leftChild": {
                                    "id": 1,
                                    "score": 1,
                                    "recordCount": 5,
                                    "predicate": {
                                        "type": "continuous",
                                        "field": "X4",
                                        "operator": "less",
                                        "splitValue": 30
                                    },
                                    "scoreDistribution": [
                                        {
                                            "category": "0",
                                            "recordCount": 0
                                        },
                                        {
                                            "category": "1",
                                            "recordCount": 5
                                        }
                                    ]
                                },
                                "rightChild": {
                                    "id": 2,
                                    "score": 0,
                                    "recordCount": 8,
                                    "predicate": {
                                        "type": "continuous",
                                        "field": "X4",
                                        "operator": "greaterOrEqual",
                                        "splitValue": 30
                                    },
                                    "scoreDistribution": [
                                        {
                                            "category": "0",
                                            "recordCount": 8
                                        },
                                        {
                                            "category": "1",
                                            "recordCount": 0
                                        }
                                    ]
                                }
                            },
                            "successClass": "1"
                        }
                    }
                ]
            }
        }
                      
                    
      • Example Request: https://rason.net/api/model/BaggingClassification?type=all

        Example Response:

        See example responses above.

Back to GET rason.net/api/model