---
title: /spark/query/latest-command/batch
slug: amberflo-api/sparkquerylatest-commandbatch
docTags: 
createdAt: 2024-11-07T15:10:16.980Z
---

{
  "id": "lXFNjbxFptNlhI5XoaAxY",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/spark/query/latest-command/batch",
    "servers": [
      {
        "url": "https://app.amberflo.io/spark/query/latest-command/batch"
      }
    ],
    "name": "",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "array",
          "description": "",
          "customType": "com.amberflo.spark.pipeline.LatestCommandRequest.in[]",
          "schema": [
            {
              "name": "accountId",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "meterApiName",
              "kind": "optional",
              "type": "string",
              "example": ""
            },
            {
              "name": "groupId",
              "kind": "optional",
              "type": "string",
              "example": ""
            }
          ],
          "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.LatestCommandRequest.in",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "array",
            "description": "",
            "customType": "com.amberflo.spark.pipeline.LatestCommandResult.out[]",
            "schema": [
              {
                "name": "query",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.LatestCommandRequest.out",
                "customType": "com.amberflo.spark.pipeline.LatestCommandRequest.out",
                "schema": [
                  {
                    "name": "accountId",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "meterApiName",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  },
                  {
                    "name": "groupId",
                    "kind": "optional",
                    "type": "string",
                    "example": ""
                  }
                ]
              },
              {
                "name": "sparkCommand",
                "kind": "optional",
                "type": "object",
                "description": "",
                "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.SparkCommand.out",
                "customType": "com.amberflo.spark.pipeline.SparkCommand.out",
                "schema": [],
                "complexType": "oneOf",
                "complexItems": [
                  {
                    "name": "com.amberflo.spark.pipeline.commands.experimental.CreateAnalyticsSnapshotCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.experimental.CreateAnalyticsSnapshotCommand.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "analytics_snapshot"
                      },
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "meterApiName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "deduplicationId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "windowStartTimeInSeconds",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "windowEndTimeInSeconds",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.spark.pipeline.commands.experimental.MauHistoryBootstrapCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.experimental.MauHistoryBootstrapCommand.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "mau_bootstrap"
                      },
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "meterApiName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "deduplicationId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "weekToRunInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.spark.pipeline.commands.experimental.MergeHourlyIngestEventsCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.experimental.MergeHourlyIngestEventsCommand.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "merge_hourly_ingest_events"
                      },
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "meterApiName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "deduplicationId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "hourToRunInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      },
                      {
                        "name": "meterApiNames",
                        "kind": "optional",
                        "type": "array",
                        "example": "",
                        "itemType": "string",
                        "customType": "string[]",
                        "itemExample": "",
                        "itemDefault": ""
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.spark.pipeline.commands.experimental.ProcessedHourlyEventsCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.experimental.ProcessedHourlyEventsCommand.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "optional",
                        "type": "string",
                        "example": "",
                        "default": "processed_hourly_events"
                      },
                      {
                        "name": "accountId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "meterApiName",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "deduplicationId",
                        "kind": "optional",
                        "type": "string",
                        "example": ""
                      },
                      {
                        "name": "hourToRunInSeconds",
                        "kind": "optional",
                        "type": "integer<int64>",
                        "example": 0
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.spark.pipeline.commands.SparkPiCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.SparkPiCommand.out",
                    "schema": [
                      {
                        "name": "",
                        "description": "",
                        "customType": "Max depth limit reached"
                      }
                    ]
                  },
                  {
                    "name": "com.amberflo.spark.pipeline.commands.experimental.UpdateHistoryCommand.out",
                    "description": "",
                    "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.commands.experimental.UpdateHistoryCommand.out",
                    "schema": [
                      {
                        "name": "",
                        "description": "",
                        "customType": "Max depth limit reached"
                      }
                    ]
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/com.amberflo.spark.pipeline.LatestCommandResult.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "r4HFTHopVdG9EEkDiLIaQ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/spark/query/latest-command/batch \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '[\n     {}\n     ]'"
        },
        {
          "id": "6G5tLiX3GJEKWro8WdS9_",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify([\n   {}\n]);\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/spark/query/latest-command/batch\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "38dl6au7AphRBOz4V_wMr",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/spark/query/latest-command/batch\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump([\n   {}\n])\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "zFm-hKgbcL_Zf6ayE3ZI0",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/spark/query/latest-command/batch\"\n\npayload = json.dumps([\n   {}\n])\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "r4HFTHopVdG9EEkDiLIaQ"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Successful request\n[\n  {\n    \"query\": {\n      \"accountId\": \"\",\n      \"meterApiName\": \"\",\n      \"groupId\": \"\"\n    },\n    \"sparkCommand\": {}\n  }\n]"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}