Chilkat Online Tools

Delphi (ActiveX) / Salesforce Platform APIs / Prediction models

Back to Collection Items

var

begin
http.AuthToken := '<access_token>';success := http.QuickGetSb('https://domain.com/services/data/v{{version}}/smartdatadiscovery/predictionDefinitions/:PREDICTION_DEFINITION_ID/models',sbResponseBody.ControlInterface);jResp.LoadSb(sbResponseBody.ControlInterface);jResp.EmitCompact := 0;jResp.I := i;Id := jResp.StringOf('models[i].createdBy.id');Name := jResp.StringOf('models[i].createdBy.name');ProfilePhotoUrl := jResp.StringOf('models[i].createdBy.profilePhotoUrl');createdDate := jResp.StringOf('models[i].createdDate');historyUrl := jResp.StringOf('models[i].historyUrl');id := jResp.StringOf('models[i].id');isRefreshEnabled := jResp.BoolOf('models[i].isRefreshEnabled');label := jResp.StringOf('models[i].label');lastModifiedById := jResp.StringOf('models[i].lastModifiedBy.id');lastModifiedByName := jResp.StringOf('models[i].lastModifiedBy.name');lastModifiedByProfilePhotoUrl := jResp.StringOf('models[i].lastModifiedBy.profilePhotoUrl');lastModifiedDate := jResp.StringOf('models[i].lastModifiedDate');modelId := jResp.StringOf('models[i].model.id');modelType := jResp.StringOf('models[i].modelType');name := jResp.StringOf('models[i].name');predictionDefinitionUrl := jResp.StringOf('models[i].predictionDefinitionUrl');sortOrder := jResp.IntOf('models[i].sortOrder');status := jResp.StringOf('models[i].status');url := jResp.StringOf('models[i].url');j := 0;count_j := jResp.SizeOfArray('models[i].fieldMappingList');jResp.J := j;Label := jResp.StringOf('models[i].fieldMappingList[j].modelField.label');modelFieldName := jResp.StringOf('models[i].fieldMappingList[j].modelField.name');v_Type := jResp.StringOf('models[i].fieldMappingList[j].modelField.type');j := j + 1;j := 0;count_j := jResp.SizeOfArray('models[i].filters');jResp.J := j;j := j + 1;j := 0;count_j := jResp.SizeOfArray('models[i].prescribableFields');jResp.J := j;fieldLabel := jResp.StringOf('models[i].prescribableFields[j].field.label');fieldName := jResp.StringOf('models[i].prescribableFields[j].field.name');fieldType := jResp.StringOf('models[i].prescribableFields[j].field.type');k := 0;count_k := jResp.SizeOfArray('models[i].prescribableFields[j].customDefinitions');jResp.K := k;k := k + 1;j := j + 1;i := i + 1;

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/smartdatadiscovery/predictionDefinitions/:PREDICTION_DEFINITION_ID/models

Postman Collection Item JSON

{
  "name": "Prediction models",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/smartdatadiscovery/predictionDefinitions/:PREDICTION_DEFINITION_ID/models",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "smartdatadiscovery",
        "predictionDefinitions",
        ":PREDICTION_DEFINITION_ID",
        "models"
      ],
      "variable": [
        {
          "key": "PREDICTION_DEFINITION_ID",
          "value": ""
        }
      ]
    },
    "description": "Get available prediction definitions."
  },
  "response": [
    {
      "name": "Prediction models",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/smartdatadiscovery/predictionDefinitions/1OR5Y0000010ws8WAA/models",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "smartdatadiscovery",
            "predictionDefinitions",
            "1OR5Y0000010ws8WAA",
            "models"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Thu, 04 Mar 2021 13:48:31 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=31536002; includeSubDomains"
        },
        {
          "key": "Expect-CT",
          "value": "max-age=86400, report-uri=\"https://a.forcesslreports.com/Expect-CT-report/00D5Y000001crJvm\""
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=UTF-8"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"models\": [\n        {\n            \"createdBy\": {\n                \"id\": \"0055Y00000DWwAIQA1\",\n                \"name\": \"Philippe Ozil\",\n                \"profilePhotoUrl\": \"https://crm-analytics-deorg-dev-ed--c.documentforce.com/profilephoto/005/T\"\n            },\n            \"createdDate\": \"2021-03-04T13:37:03.000Z\",\n            \"fieldMappingList\": [\n                {\n                    \"modelField\": {\n                        \"label\": \"Category\",\n                        \"name\": \"Category\",\n                        \"type\": \"Text\"\n                    }\n                },\n                {\n                    \"modelField\": {\n                        \"label\": \"Sales\",\n                        \"name\": \"Sales\",\n                        \"type\": \"Number\"\n                    }\n                },\n                {\n                    \"modelField\": {\n                        \"label\": \"Profit per Order\",\n                        \"name\": \"Profit_per_Order\",\n                        \"type\": \"Number\"\n                    }\n                },\n                {\n                    \"modelField\": {\n                        \"label\": \"Sub-Category\",\n                        \"name\": \"Sub_Category\",\n                        \"type\": \"Text\"\n                    }\n                },\n                {\n                    \"modelField\": {\n                        \"label\": \"Quantity\",\n                        \"name\": \"Quantity\",\n                        \"type\": \"Number\"\n                    }\n                }\n            ],\n            \"filters\": [],\n            \"historyUrl\": \"/services/data/v51.0/smartdatadiscovery/predictiondefinitions/1OR5Y0000010ws8WAA/models/1Ot5Y0000010wzNSAQ/histories\",\n            \"id\": \"1Ot5Y0000010wzNSAQ\",\n            \"isRefreshEnabled\": false,\n            \"label\": \"superstore-orders\",\n            \"lastModifiedBy\": {\n                \"id\": \"0055Y00000DWwAIQA1\",\n                \"name\": \"Philippe Ozil\",\n                \"profilePhotoUrl\": \"https://crm-analytics-deorg-dev-ed--c.documentforce.com/profilephoto/005/T\"\n            },\n            \"lastModifiedDate\": \"2021-03-04T13:37:03.000Z\",\n            \"model\": {\n                \"id\": \"1OT5Y0000010zlzWAA\"\n            },\n            \"modelType\": \"Regression\",\n            \"name\": \"superstore_orders\",\n            \"predictionDefinitionUrl\": \"/services/data/v51.0/smartdatadiscovery/predictiondefinitions/1OR5Y0000010ws8WAA\",\n            \"prescribableFields\": [\n                {\n                    \"customDefinitions\": [],\n                    \"field\": {\n                        \"label\": \"Quantity\",\n                        \"name\": \"Quantity\",\n                        \"type\": \"Number\"\n                    }\n                }\n            ],\n            \"sortOrder\": 0,\n            \"status\": \"Enabled\",\n            \"url\": \"/services/data/v51.0/smartdatadiscovery/predictiondefinitions/1OR5Y0000010ws8WAA/models/1Ot5Y0000010wzNSAQ\"\n        }\n    ],\n    \"totalSize\": 1,\n    \"url\": \"/services/data/v51.0/smartdatadiscovery/predictiondefinitions/1OR5Y0000010ws8WAA/models\"\n}"
    }
  ]
}