Delen via


Query - Batch

Een batch met Analysequery's uitvoeren
Hiermee wordt een batch analysequery's voor gegevens uitgevoerd. Hier volgt een voorbeeld voor het gebruik van POST met een Analytics-query.

POST https://api.loganalytics.io/v1/$batch

Aanvraagbody

Name Vereist Type Description
requests True

batchQueryRequest[]

Eén aanvraag in een batch.

Antwoorden

Name Type Description
200 OK

batchResponse

OK. De API-aanroep is geslaagd en het resultaat van de analysequery bevindt zich in de nettolading van het antwoord

Other Status Codes

errorResponse

Een foutreactieobject.

Beveiliging

oauth2

Azure Active Directory OAuth2-stroom

Type: oauth2
Stroom: implicit
Autorisatie-URL: https://login.microsoftonline.com/common/oauth2/authorize

Bereiken

Name Description
user_impersonation uw gebruikersaccount imiteren

Voorbeelden

metadataPost

Voorbeeldaanvraag

POST https://api.loganalytics.io/v1/$batch

{
  "requests": [
    {
      "id": "1",
      "body": {
        "query": "AppRequests | take 2"
      },
      "path": "/query",
      "method": "POST",
      "workspace": "d2d0e126-fa1e-4b0a-b647-250cdd471e68"
    },
    {
      "id": "2",
      "body": {
        "query": "AppRequests | take 3"
      },
      "path": "/query",
      "method": "POST",
      "workspace": "d2d0e126-fa1e-4b0a-b647-250cdd471e68"
    }
  ]
}

Voorbeeldrespons

{
  "responses": [
    {
      "id": "1",
      "status": 200,
      "body": {
        "tables": [
          {
            "name": "PrimaryResult",
            "columns": [
              {
                "name": "TenantId",
                "type": "string"
              },
              {
                "name": "TimeGenerated",
                "type": "datetime"
              },
              {
                "name": "Id",
                "type": "string"
              },
              {
                "name": "Source",
                "type": "string"
              },
              {
                "name": "Name",
                "type": "string"
              },
              {
                "name": "Url",
                "type": "string"
              },
              {
                "name": "Success",
                "type": "bool"
              },
              {
                "name": "ResultCode",
                "type": "string"
              },
              {
                "name": "DurationMs",
                "type": "real"
              },
              {
                "name": "PerformanceBucket",
                "type": "string"
              },
              {
                "name": "Properties",
                "type": "dynamic"
              },
              {
                "name": "Measurements",
                "type": "dynamic"
              },
              {
                "name": "OperationName",
                "type": "string"
              },
              {
                "name": "OperationId",
                "type": "string"
              },
              {
                "name": "OperationLinks",
                "type": "dynamic"
              },
              {
                "name": "ParentId",
                "type": "string"
              },
              {
                "name": "SyntheticSource",
                "type": "string"
              },
              {
                "name": "SessionId",
                "type": "string"
              },
              {
                "name": "UserId",
                "type": "string"
              },
              {
                "name": "UserAuthenticatedId",
                "type": "string"
              },
              {
                "name": "UserAccountId",
                "type": "string"
              },
              {
                "name": "AppVersion",
                "type": "string"
              },
              {
                "name": "AppRoleName",
                "type": "string"
              },
              {
                "name": "AppRoleInstance",
                "type": "string"
              },
              {
                "name": "ClientType",
                "type": "string"
              },
              {
                "name": "ClientModel",
                "type": "string"
              },
              {
                "name": "ClientOS",
                "type": "string"
              },
              {
                "name": "ClientIP",
                "type": "string"
              },
              {
                "name": "ClientCity",
                "type": "string"
              },
              {
                "name": "ClientStateOrProvince",
                "type": "string"
              },
              {
                "name": "ClientCountryOrRegion",
                "type": "string"
              },
              {
                "name": "ClientBrowser",
                "type": "string"
              },
              {
                "name": "ResourceGUID",
                "type": "string"
              },
              {
                "name": "IKey",
                "type": "string"
              },
              {
                "name": "SDKVersion",
                "type": "string"
              },
              {
                "name": "ItemCount",
                "type": "int"
              },
              {
                "name": "ReferencedItemId",
                "type": "string"
              },
              {
                "name": "ReferencedType",
                "type": "string"
              },
              {
                "name": "SourceSystem",
                "type": "string"
              },
              {
                "name": "Type",
                "type": "string"
              },
              {
                "name": "_ResourceId",
                "type": "string"
              }
            ],
            "rows": [
              [
                "d2d0e126-fa1e-4b0a-b647-250cdd471e68",
                "2021-06-02T00:18:13.317Z",
                "a3273b160f86b5c4",
                "",
                "ServiceBus.process",
                "",
                true,
                "200",
                0,
                "<250ms",
                "{\"x-opt-enqueued-time\":\"1622593091\"}",
                null,
                "ServiceBus.process",
                "e5d21caf619d4ef564a4b5920cadce47",
                null,
                "c6864f9d3649f302",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "srikanta",
                "PC",
                "",
                "",
                "0.0.0.0",
                "Edmonds",
                "Washington",
                "United States",
                "",
                "fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
                "b4f83947-968d-4e2f-82ad-804be07697ae",
                "java:3.1.1-BETA.2",
                1,
                "",
                "",
                "Azure",
                "AppRequests",
                "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
              ],
              [
                "d2d0e126-fa1e-4b0a-b647-250cdd471e68",
                "2021-06-02T00:19:13.44Z",
                "bebb49e7a1344c07",
                "",
                "ServiceBus.process",
                "",
                true,
                "200",
                0,
                "<250ms",
                "{\"x-opt-enqueued-time\":\"1622593091\"}",
                null,
                "ServiceBus.process",
                "d76c6dec50d2c12267d7d3a246a0c237",
                null,
                "b68fff4775c77214",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "srikanta",
                "PC",
                "",
                "",
                "0.0.0.0",
                "Edmonds",
                "Washington",
                "United States",
                "",
                "fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
                "b4f83947-968d-4e2f-82ad-804be07697ae",
                "java:3.1.1-BETA.2",
                1,
                "",
                "",
                "Azure",
                "AppRequests",
                "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
              ]
            ]
          }
        ]
      }
    },
    {
      "id": "2",
      "status": 200,
      "body": {
        "tables": [
          {
            "name": "PrimaryResult",
            "columns": [
              {
                "name": "TenantId",
                "type": "string"
              },
              {
                "name": "TimeGenerated",
                "type": "datetime"
              },
              {
                "name": "Id",
                "type": "string"
              },
              {
                "name": "Source",
                "type": "string"
              },
              {
                "name": "Name",
                "type": "string"
              },
              {
                "name": "Url",
                "type": "string"
              },
              {
                "name": "Success",
                "type": "bool"
              },
              {
                "name": "ResultCode",
                "type": "string"
              },
              {
                "name": "DurationMs",
                "type": "real"
              },
              {
                "name": "PerformanceBucket",
                "type": "string"
              },
              {
                "name": "Properties",
                "type": "dynamic"
              },
              {
                "name": "Measurements",
                "type": "dynamic"
              },
              {
                "name": "OperationName",
                "type": "string"
              },
              {
                "name": "OperationId",
                "type": "string"
              },
              {
                "name": "OperationLinks",
                "type": "dynamic"
              },
              {
                "name": "ParentId",
                "type": "string"
              },
              {
                "name": "SyntheticSource",
                "type": "string"
              },
              {
                "name": "SessionId",
                "type": "string"
              },
              {
                "name": "UserId",
                "type": "string"
              },
              {
                "name": "UserAuthenticatedId",
                "type": "string"
              },
              {
                "name": "UserAccountId",
                "type": "string"
              },
              {
                "name": "AppVersion",
                "type": "string"
              },
              {
                "name": "AppRoleName",
                "type": "string"
              },
              {
                "name": "AppRoleInstance",
                "type": "string"
              },
              {
                "name": "ClientType",
                "type": "string"
              },
              {
                "name": "ClientModel",
                "type": "string"
              },
              {
                "name": "ClientOS",
                "type": "string"
              },
              {
                "name": "ClientIP",
                "type": "string"
              },
              {
                "name": "ClientCity",
                "type": "string"
              },
              {
                "name": "ClientStateOrProvince",
                "type": "string"
              },
              {
                "name": "ClientCountryOrRegion",
                "type": "string"
              },
              {
                "name": "ClientBrowser",
                "type": "string"
              },
              {
                "name": "ResourceGUID",
                "type": "string"
              },
              {
                "name": "IKey",
                "type": "string"
              },
              {
                "name": "SDKVersion",
                "type": "string"
              },
              {
                "name": "ItemCount",
                "type": "int"
              },
              {
                "name": "ReferencedItemId",
                "type": "string"
              },
              {
                "name": "ReferencedType",
                "type": "string"
              },
              {
                "name": "SourceSystem",
                "type": "string"
              },
              {
                "name": "Type",
                "type": "string"
              },
              {
                "name": "_ResourceId",
                "type": "string"
              }
            ],
            "rows": [
              [
                "d2d0e126-fa1e-4b0a-b647-250cdd471e68",
                "2021-06-02T16:31:25.383Z",
                "08bf242cdc68504c",
                "",
                "ServiceBus.process",
                "",
                true,
                "200",
                0,
                "<250ms",
                "{\"x-opt-enqueued-time\":\"1622651483\"}",
                null,
                "ServiceBus.process",
                "65d9eb1ccf85b1b7ed1e2ea6bb72f563",
                null,
                "146140ce8493a6ed",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "srikanta",
                "PC",
                "",
                "",
                "0.0.0.0",
                "Edmonds",
                "Washington",
                "United States",
                "",
                "fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
                "b4f83947-968d-4e2f-82ad-804be07697ae",
                "java:3.1.1-BETA.2",
                1,
                "",
                "",
                "Azure",
                "AppRequests",
                "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
              ],
              [
                "d2d0e126-fa1e-4b0a-b647-250cdd471e68",
                "2021-06-02T16:32:25.492Z",
                "9f4cd78c10d57b4f",
                "",
                "ServiceBus.process",
                "",
                true,
                "200",
                0,
                "<250ms",
                "{\"x-opt-enqueued-time\":\"1622651483\"}",
                null,
                "ServiceBus.process",
                "ae054fe7b7ac3adf8b841ebbe1ecb912",
                null,
                "14eab103a1969665",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "srikanta",
                "PC",
                "",
                "",
                "0.0.0.0",
                "Edmonds",
                "Washington",
                "United States",
                "",
                "fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
                "b4f83947-968d-4e2f-82ad-804be07697ae",
                "java:3.1.1-BETA.2",
                1,
                "",
                "",
                "Azure",
                "AppRequests",
                "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
              ],
              [
                "d2d0e126-fa1e-4b0a-b647-250cdd471e68",
                "2021-06-02T16:33:25.585Z",
                "ea7e09d4baa4e4ce",
                "",
                "ServiceBus.process",
                "",
                true,
                "200",
                0,
                "<250ms",
                "{\"x-opt-enqueued-time\":\"1622651483\"}",
                null,
                "ServiceBus.process",
                "ba6162e3ccd803086944750b82600a3a",
                null,
                "b60455183860caaf",
                "",
                "",
                "",
                "",
                "",
                "",
                "",
                "srikanta",
                "PC",
                "",
                "",
                "0.0.0.0",
                "Edmonds",
                "Washington",
                "United States",
                "",
                "fc5f5a5d-d6d1-47f9-be1b-aa57185ec6be",
                "b4f83947-968d-4e2f-82ad-804be07697ae",
                "java:3.1.1-BETA.2",
                1,
                "",
                "",
                "Azure",
                "AppRequests",
                "/subscriptions/faa080af-c1d8-40ad-9cce-e1a450ca5b57/resourcegroups/srnagar-azuresdkgroup/providers/microsoft.insights/components/srnagarappinsights"
              ]
            ]
          }
        ]
      }
    }
  ]
}

Definities

Name Description
batchQueryRequest

Eén aanvraag in een batch.

batchQueryResponse
batchQueryResults

Een queryantwoord voor één query in een batch.

batchRequest

Een matrix met aanvragen.

batchResponse

Antwoord op een batchquery.

column

Een tabelkolom.

errorDetail

Foutdetails.

errorInfo

De code en het bericht voor een fout.

errorResponse

Foutdetails.

logsColumnType

Het gegevenstype van deze kolom.

methodType
path
queryBody

De Analysequery. Meer informatie over de analysequerysyntaxis

Render

Visualisatiegegevens in JSON-indeling.

Statistics

Statistieken weergegeven in JSON-indeling.

table

Een queryantwoordtabel.

batchQueryRequest

Eén aanvraag in een batch.

Name Type Description
body

queryBody

De Analysequery. Meer informatie over de analysequerysyntaxis

headers

object

id

string

De foutdetails.

method

methodType

path

path

workspace

string

Werkruimte-id die moet worden opgenomen in de query

batchQueryResponse

Name Type Description
body

batchQueryResults

Een queryantwoord voor één query in een batch.
Bevat de tabellen, kolommen & rijen die het resultaat zijn van een query.

headers

object

id

string

status

integer

batchQueryResults

Een queryantwoord voor één query in een batch.

Name Type Description
error

errorInfo

De code en het bericht voor een fout.

render

Render

Visualisatiegegevens in JSON-indeling.

statistics

Statistics

Statistieken weergegeven in JSON-indeling.

tables

table[]

De lijst met tabellen, kolommen en rijen.

batchRequest

Een matrix met aanvragen.

Name Type Description
requests

batchQueryRequest[]

Eén aanvraag in een batch.

batchResponse

Antwoord op een batchquery.

Name Type Description
responses

batchQueryResponse[]

Een matrix met antwoorden die overeenkomen met elke afzonderlijke aanvraag in een batch.

column

Een tabelkolom.

Name Type Description
name

string

De naam van deze kolom.

type

logsColumnType

Het gegevenstype van deze kolom.

errorDetail

Foutdetails.

Name Type Description
additionalProperties

object

Aanvullende eigenschappen die kunnen worden opgegeven voor het object foutdetails

code

string

De code van de fout.

message

string

Een door mensen leesbaar foutbericht.

resources

string[]

Geeft resources aan die verantwoordelijk waren voor de fout.

target

string

Geeft aan welke eigenschap in de aanvraag verantwoordelijk is voor de fout.

value

string

Geeft aan welke waarde in 'doel' verantwoordelijk is voor de fout.

errorInfo

De code en het bericht voor een fout.

Name Type Description
additionalProperties

object

Aanvullende eigenschappen die kunnen worden opgegeven voor het foutinformatieobject

code

string

Een door de machine leesbare foutcode.

details

errorDetail[]

details van de fout.

innererror

errorInfo

De code en het bericht voor een fout.
Details van interne fout, indien aanwezig.

message

string

Een door mensen leesbaar foutbericht.

errorResponse

Foutdetails.

Name Type Description
error

errorInfo

De code en het bericht voor een fout.
De foutdetails.

logsColumnType

Het gegevenstype van deze kolom.

Name Type Description
bool

string

datetime

string

decimal

string

dynamic

string

guid

string

int

string

long

string

real

string

string

string

timespan

string

methodType

Name Type Description
POST

string

path

Name Type Description
/query

string

queryBody

De Analysequery. Meer informatie over de analysequerysyntaxis

Name Type Description
query

string

De query die moet worden uitgevoerd.

timespan

string

Optioneel. De periode waarin gegevens moeten worden opgevraagd. Dit is een ISO8601 tijdsperiodewaarde. Deze periode wordt toegepast naast alle die zijn opgegeven in de query-expressie.

workspaces

string[]

Een lijst met werkruimten die zijn opgenomen in de query.

Render

Visualisatiegegevens in JSON-indeling.

Statistics

Statistieken weergegeven in JSON-indeling.

table

Een queryantwoordtabel.

Name Type Description
columns

column[]

De lijst met kolommen in deze tabel.

name

string

De naam van de tabel.

rows

object[]

De resulterende rijen van deze query.