Query - Batch
Exécuter un lot de requêtes Analytics
Exécute un lot de requêtes Analytics pour les données.
Voici un exemple d’utilisation de POST avec une requête Analytics.
POST https://api.loganalytics.io/v1/$batch
Corps de la demande
Nom | Obligatoire | Type | Description |
---|---|---|---|
requests | True |
Requête unique dans un lot. |
Réponses
Nom | Type | Description |
---|---|---|
200 OK |
OK. L’appel d’API a réussi et le résultat de la requête Analytics se trouve dans la charge utile de réponse |
|
Other Status Codes |
Objet de réponse d’erreur. |
Sécurité
oauth2
Flux OAuth2 Azure Active Directory
Type:
oauth2
Flux:
implicit
URL d’autorisation:
https://login.microsoftonline.com/common/oauth2/authorize
Étendues
Nom | Description |
---|---|
user_impersonation | Emprunter l’identité de votre compte d’utilisateur |
Exemples
metadataPost
Exemple de requête
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"
}
]
}
Exemple de réponse
{
"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"
]
]
}
]
}
}
]
}
Définitions
Nom | Description |
---|---|
batch |
Requête unique dans un lot. |
batch |
|
batch |
Réponse à une requête unique dans un lot. |
batch |
Tableau de requêtes. |
batch |
Réponse à une requête par lots. |
column |
Colonne de table. |
error |
Détails de l’erreur. |
error |
Code et message d’une erreur. |
error |
Détails de l’erreur. |
logs |
Type de données de cette colonne. |
method |
|
path | |
query |
Requête Analytics. En savoir plus sur la syntaxe de requête Analytics |
Render |
Visualisation des données au format JSON. |
Statistics |
Statistiques représentées au format JSON. |
table |
Table de réponse de requête. |
batchQueryRequest
Requête unique dans un lot.
Nom | Type | Description |
---|---|---|
body |
Requête Analytics. En savoir plus sur la syntaxe de requête Analytics |
|
headers |
object |
|
id |
string |
Détails de l’erreur. |
method | ||
path | ||
workspace |
string |
ID d’espace de travail à inclure dans la requête |
batchQueryResponse
Nom | Type | Description |
---|---|---|
body |
Réponse à une requête unique dans un lot. |
|
headers |
object |
|
id |
string |
|
status |
integer |
batchQueryResults
Réponse à une requête unique dans un lot.
Nom | Type | Description |
---|---|---|
error |
Code et message d’une erreur. |
|
render |
Visualisation des données au format JSON. |
|
statistics |
Statistiques représentées au format JSON. |
|
tables |
table[] |
Liste des tables, colonnes et lignes. |
batchRequest
Tableau de requêtes.
Nom | Type | Description |
---|---|---|
requests |
Requête unique dans un lot. |
batchResponse
Réponse à une requête par lots.
Nom | Type | Description |
---|---|---|
responses |
Tableau de réponses correspondant à chaque requête individuelle dans un lot. |
column
Colonne de table.
Nom | Type | Description |
---|---|---|
name |
string |
Nom de cette colonne. |
type |
Type de données de cette colonne. |
errorDetail
Détails de l’erreur.
Nom | Type | Description |
---|---|---|
additionalProperties |
object |
Propriétés supplémentaires qui peuvent être fournies sur l’objet détails de l’erreur |
code |
string |
Code de l’erreur. |
message |
string |
Message d’erreur lisible par l’homme. |
resources |
string[] |
Indique les ressources responsables de l’erreur. |
target |
string |
Indique la propriété de la requête responsable de l’erreur. |
value |
string |
Indique la valeur dans 'target' qui est responsable de l’erreur. |
errorInfo
Code et message d’une erreur.
Nom | Type | Description |
---|---|---|
additionalProperties |
object |
Propriétés supplémentaires qui peuvent être fournies sur l’objet d’informations d’erreur |
code |
string |
Code d’erreur lisible par machine. |
details |
détails de l’erreur. |
|
innererror |
Code et message d’une erreur. |
|
message |
string |
Message d’erreur lisible par l’homme. |
errorResponse
Détails de l’erreur.
Nom | Type | Description |
---|---|---|
error |
Code et message d’une erreur. |
logsColumnType
Type de données de cette colonne.
Nom | Type | Description |
---|---|---|
bool |
string |
|
datetime |
string |
|
decimal |
string |
|
dynamic |
string |
|
guid |
string |
|
int |
string |
|
long |
string |
|
real |
string |
|
string |
string |
|
timespan |
string |
methodType
Nom | Type | Description |
---|---|---|
POST |
string |
path
Nom | Type | Description |
---|---|---|
/query |
string |
queryBody
Requête Analytics. En savoir plus sur la syntaxe de requête Analytics
Nom | Type | Description |
---|---|---|
query |
string |
Requête à exécuter. |
timespan |
string |
facultatif. Intervalle de temps sur lequel interroger des données. Il s’agit d’une valeur de période ISO8601. Cet intervalle de temps est appliqué en plus de tous les éléments spécifiés dans l’expression de requête. |
workspaces |
string[] |
Liste des espaces de travail inclus dans la requête. |
Render
Visualisation des données au format JSON.
Statistics
Statistiques représentées au format JSON.
table
Table de réponse de requête.
Nom | Type | Description |
---|---|---|
columns |
column[] |
Liste des colonnes de cette table. |
name |
string |
Nom de la table. |
rows |
object[] |
Lignes résultantes de cette requête. |