{
  "swagger": "2.0",
  "info": {
    "title": "North52 Execute Formula",
    "description": "Executes a North52 client-side formula via the Dataverse Web API and returns the result.",
    "version": "1.0.0",
    "contact": {
      "name": "North52 Support",
      "url": "https://support.north52.com"
    }
  },
  "host": "xxx.crm.dynamics.com",
  "basePath": "/api/data/v9.2",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/north52_formulacalculations": {
      "get": {
        "summary": "Execute Formula",
        "description": "Executes a North52 client-side formula and returns the result. All filter criteria must be passed inside $filter as an OData string. Example $filter value:\n  north52_name eq '2Df' and north52_parameters eq '' and north52_targetentityid eq '' and north52_formulatype eq '99'",
        "operationId": "ExecuteFormula",
        "parameters": [
          {
            "name": "$select",
            "in": "query",
            "required": false,
            "type": "string",
            "default": "north52_result",
            "description": "Fields to return. Defaults to north52_result.",
            "x-ms-summary": "Select Fields",
            "x-ms-visibility": "advanced"
          },
          {
            "name": "$filter",
            "in": "query",
            "required": true,
            "type": "string",
            "description": "OData filter string containing all formula execution criteria. Must include all four conditions: north52_name eq '{shortcode}' and north52_parameters eq '{params}' and north52_targetentityid eq '{guid}' and north52_formulatype eq '99'",
            "x-ms-summary": "Filter",
            "x-ms-visibility": "important"
          }
        ],
        "responses": {
          "200": {
            "description": "Formula executed successfully.",
            "schema": {
              "type": "object",
              "properties": {
                "@odata.context": {
                  "type": "string",
                  "description": "OData metadata context URL.",
                  "x-ms-summary": "OData Context"
                },
                "value": {
                  "type": "array",
                  "description": "Array containing the formula calculation result.",
                  "x-ms-summary": "Results",
                  "items": {
                    "type": "object",
                    "properties": {
                      "north52_formulacalculationid": {
                        "type": "string",
                        "description": "Unique identifier of the formula calculation record.",
                        "x-ms-summary": "Formula Calculation ID"
                      },
                      "north52_name": {
                        "type": "string",
                        "description": "The short code / name of the executed formula.",
                        "x-ms-summary": "Short Code"
                      },
                      "north52_result": {
                        "type": "string",
                        "description": "The result returned by the formula (may be a JSON string).",
                        "x-ms-summary": "Formula Result"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request — check $filter syntax and values."
          },
          "401": {
            "description": "Unauthorized — re-authenticate the connector connection."
          },
          "404": {
            "description": "Not Found — formula name or record could not be found."
          }
        },
        "x-ms-visibility": "important"
      }
    }
  },
  "definitions": {},
  "parameters": {},
  "responses": {},
  "security": [
    {
      "oauth2-auth": []
    }
  ],
  "tags": [],
  "securityDefinitions": {
    "oauth2-auth": {
      "type": "oauth2",
      "flow": "accessCode",
      "tokenUrl": "https://login.windows.net/common/oauth2/authorize",
      "scopes": {},
      "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize"
    }
  },
  "x-ms-connector-metadata": [
    {
      "propertyName": "Website",
      "propertyValue": "https://north52.com"
    },
    {
      "propertyName": "Privacy policy",
      "propertyValue": "https://north52.com/privacy"
    },
    {
      "propertyName": "Categories",
      "propertyValue": "Business Intelligence;Data"
    }
  ]
}