Query - Batch
Executar um lote de consultas do Google Analytics
Executa um lote de consultas de dados do Google Analytics.
Aqui está um exemplo de uso do POST com uma consulta do Google Analytics.
POST https://api.loganalytics.io/v1/$batch
Corpo do Pedido
Name | Necessário | Tipo | Description |
---|---|---|---|
requests | True |
Uma única solicitação em um lote. |
Respostas
Name | Tipo | Description |
---|---|---|
200 OK |
OK. A chamada de API foi bem-sucedida e o resultado da consulta do Google Analytics está na carga útil de resposta |
|
Other Status Codes |
Um objeto de resposta de erro. |
Segurança
oauth2
Azure Ative Directory OAuth2 Flow
Tipo:
oauth2
Fluxo:
implicit
URL de Autorização:
https://login.microsoftonline.com/common/oauth2/authorize
Âmbitos
Name | Description |
---|---|
user_impersonation | personificar a sua conta de utilizador |
Exemplos
metadataPost
Pedido de amostra
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"
}
]
}
Resposta da amostra
{
"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"
]
]
}
]
}
}
]
}
Definições
Name | Description |
---|---|
batch |
Uma única solicitação em um lote. |
batch |
|
batch |
Uma resposta de consulta para uma única consulta em um lote. |
batch |
Uma série de solicitações. |
batch |
Resposta a uma consulta em lotes. |
column |
Uma coluna de tabela. |
error |
Detalhes do erro. |
error |
O código e a mensagem para um erro. |
error |
Detalhes do erro. |
logs |
O tipo de dados desta coluna. |
method |
|
path | |
query |
A consulta do Google Analytics. Saiba mais sobre a sintaxe de consulta do Analytics |
Render |
Dados de visualização em formato JSON. |
Statistics |
Estatísticas representadas em formato JSON. |
table |
Uma tabela de resposta à consulta. |
batchQueryRequest
Uma única solicitação em um lote.
Name | Tipo | Description |
---|---|---|
body |
A consulta do Google Analytics. Saiba mais sobre a sintaxe de consulta do Analytics |
|
headers |
object |
|
id |
string |
Os detalhes do erro. |
method | ||
path | ||
workspace |
string |
ID do espaço de trabalho a ser incluído na consulta |
batchQueryResponse
Name | Tipo | Description |
---|---|---|
body |
Uma resposta de consulta para uma única consulta em um lote. |
|
headers |
object |
|
id |
string |
|
status |
integer (int64) |
batchQueryResults
Uma resposta de consulta para uma única consulta em um lote.
Name | Tipo | Description |
---|---|---|
error |
O código e a mensagem para um erro. |
|
render |
Dados de visualização em formato JSON. |
|
statistics |
Estatísticas representadas em formato JSON. |
|
tables |
table[] |
A lista de tabelas, colunas e linhas. |
batchRequest
Uma série de solicitações.
Name | Tipo | Description |
---|---|---|
requests |
Uma única solicitação em um lote. |
batchResponse
Resposta a uma consulta em lotes.
Name | Tipo | Description |
---|---|---|
responses |
Uma matriz de respostas correspondente a cada solicitação individual em um lote. |
column
Uma coluna de tabela.
Name | Tipo | Description |
---|---|---|
name |
string |
O nome desta coluna. |
type |
O tipo de dados desta coluna. |
errorDetail
Detalhes do erro.
Name | Tipo | Description |
---|---|---|
additionalProperties |
object |
Propriedades adicionais que podem ser fornecidas no objeto de detalhes do erro |
code |
string |
O código do erro. |
message |
string |
Uma mensagem de erro legível por humanos. |
resources |
string[] |
Indica os recursos que foram responsáveis pelo erro. |
target |
string |
Indica qual propriedade na solicitação é responsável pelo erro. |
value |
string |
Indica qual valor em 'target' é responsável pelo erro. |
errorInfo
O código e a mensagem para um erro.
Name | Tipo | Description |
---|---|---|
additionalProperties |
object |
Propriedades adicionais que podem ser fornecidas no objeto de informações de erro |
code |
string |
Um código de erro legível por máquina. |
details |
detalhes do erro. |
|
innererror |
O código e a mensagem para um erro. |
|
message |
string |
Uma mensagem de erro legível por humanos. |
errorResponse
Detalhes do erro.
Name | Tipo | Description |
---|---|---|
error |
O código e a mensagem para um erro. |
logsColumnType
O tipo de dados desta coluna.
Valor | Description |
---|---|
bool | |
datetime | |
decimal | |
dynamic | |
guid | |
int | |
long | |
real | |
string | |
timespan |
methodType
Valor | Description |
---|---|
POST |
path
Valor | Description |
---|---|
/query |
queryBody
A consulta do Google Analytics. Saiba mais sobre a sintaxe de consulta do Analytics
Name | Tipo | Description |
---|---|---|
query |
string |
A consulta a ser executada. |
timespan |
string |
Opcional. O período de tempo durante o qual consultar dados. Este é um valor de período de tempo ISO8601. Esse período de tempo é aplicado além de qualquer um especificado na expressão de consulta. |
workspaces |
string[] |
Uma lista de espaços de trabalho incluídos na consulta. |
Render
Dados de visualização em formato JSON.
Statistics
Estatísticas representadas em formato JSON.
table
Uma tabela de resposta à consulta.
Name | Tipo | Description |
---|---|---|
columns |
column[] |
A lista de colunas nesta tabela. |
name |
string |
O nome da tabela. |
rows |
object[] |
As linhas resultantes desta consulta. |