Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) Azure Monitor - List Activity LogsProvides the list of records from the activity logs. Note: The $filter criteria cannot specify a time range that begins more than 90 days in the past. For more information, see https://docs.microsoft.com/en-us/rest/api/monitor/activitylogs/list
#include <C_CkHttpW.h> #include <C_CkJsonObjectW.h> #include <C_CkHttpResponseW.h> void ChilkatSample(void) { HCkHttpW http; HCkJsonObjectW jsonToken; BOOL success; HCkHttpResponseW resp; HCkJsonObjectW jsonResponse; const wchar_t *nextLink; int i; int count_i; const wchar_t *authorizationAction; const wchar_t *authorizationRole; const wchar_t *authorizationScope; const wchar_t *caller; const wchar_t *claimsAud; const wchar_t *claimsIss; const wchar_t *claimsIat; const wchar_t *claimsNbf; const wchar_t *claimsExp; const wchar_t *claimsVer; const wchar_t *claims_identity_claims_tenantid; const wchar_t *claims_claims_authnmethodsreferences; const wchar_t *claims_identity_claims_objectidentifier; const wchar_t *claims_ws_2005_05_identity_claims_upn; const wchar_t *claimsPuid; const wchar_t *claims_ws_2005_05_identity_claims_nameidentifier; const wchar_t *claims_ws_2005_05_identity_claims_givenname; const wchar_t *claims_ws_2005_05_identity_claims_surname; const wchar_t *claimsName; const wchar_t *claimsGroups; const wchar_t *claims_ws_2005_05_identity_claims_name; const wchar_t *claimsAppid; const wchar_t *claimsAppidacr; const wchar_t *claims_identity_claims_scope; const wchar_t *claims_claims_authnclassreference; const wchar_t *correlationId; const wchar_t *description; const wchar_t *eventDataId; const wchar_t *eventNameValue; const wchar_t *eventNameLocalizedValue; const wchar_t *httpRequestClientRequestId; const wchar_t *httpRequestClientIpAddress; const wchar_t *httpRequestMethod; const wchar_t *id; const wchar_t *level; const wchar_t *resourceGroupName; const wchar_t *resourceProviderNameValue; const wchar_t *resourceProviderNameLocalizedValue; const wchar_t *operationId; const wchar_t *operationNameValue; const wchar_t *operationNameLocalizedValue; const wchar_t *propertiesStatusCode; const wchar_t *statusValue; const wchar_t *statusLocalizedValue; const wchar_t *subStatusValue; const wchar_t *subStatusLocalizedValue; const wchar_t *eventTimestamp; const wchar_t *submissionTimestamp; const wchar_t *subscriptionId; // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. http = CkHttpW_Create(); // Load an OAuth2 access token previously fetched by this example: Get Azure OAuth2 Access Token jsonToken = CkJsonObjectW_Create(); success = CkJsonObjectW_LoadFile(jsonToken,L"qa_data/tokens/azureToken.json"); // Assuming success.. CkHttpW_putAuthToken(http,CkJsonObjectW_stringOf(jsonToken,L"access_token")); wprintf(L"AuthToken: %s\n",CkHttpW_authToken(http)); CkHttpW_putAccept(http,L"application/json"); resp = CkHttpW_QuickRequest(http,L"GET",L"https://management.azure.com/subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp%20ge%20%272019-05-16T04%3A36%3A37.6407898Z%27%20and%20eventTimestamp%20le%20%272019-06-12T04%3A36%3A37.6407898Z%27"); if (CkHttpW_getLastMethodSuccess(http) != TRUE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); return; } wprintf(L"Response Status Code: %d\n",CkHttpResponseW_getStatusCode(resp)); jsonResponse = CkJsonObjectW_Create(); CkJsonObjectW_Load(jsonResponse,CkHttpResponseW_bodyStr(resp)); CkJsonObjectW_putEmitCompact(jsonResponse,FALSE); wprintf(L"%s\n",CkJsonObjectW_emit(jsonResponse)); if (CkHttpResponseW_getStatusCode(resp) != 200) { wprintf(L"Failed.\n"); CkHttpResponseW_Dispose(resp); CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); CkJsonObjectW_Dispose(jsonResponse); return; } CkHttpResponseW_Dispose(resp); // Sample output... // (See the parsing code below..) // // Use the this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // { // "value": [ // { // "authorization": { // "action": "microsoft.support/supporttickets/write", // "role": "Subscription Admin", // "scope": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841" // }, // "caller": "admin@contoso.com", // "claims": { // "aud": "https://management.core.windows.net/", // "iss": "https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/", // "iat": "1421876371", // "nbf": "1421876371", // "exp": "1421880271", // "ver": "1.0", // "http://schemas.microsoft.com/identity/claims/tenantid": "1e8d8218-c5e7-4578-9acc-9abbd5d23315 ", // "http://schemas.microsoft.com/claims/authnmethodsreferences": "pwd", // "http://schemas.microsoft.com/identity/claims/objectidentifier": "2468adf0-8211-44e3-95xq-85137af64708", // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": "admin@contoso.com", // "puid": "20030000801A118C", // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM", // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": "John", // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": "Smith", // "name": "John Smith", // "groups": "cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c", // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": " admin@contoso.com", // "appid": "c44b4083-3bq0-49c1-b47d-974e53cbdf3c", // "appidacr": "2", // "http://schemas.microsoft.com/identity/claims/scope": "user_impersonation", // "http://schemas.microsoft.com/claims/authnclassreference": "1" // }, // "correlationId": "1e121103-0ba6-4300-ac9d-952bb5d0c80f", // "description": "", // "eventDataId": "44ade6b4-3813-45e6-ae27-7420a95fa2f8", // "eventName": { // "value": "EndRequest", // "localizedValue": "End request" // }, // "httpRequest": { // "clientRequestId": "27003b25-91d3-418f-8eb1-29e537dcb249", // "clientIpAddress": "192.168.35.115", // "method": "PUT" // }, // "id": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776", // "level": "Informational", // "resourceGroupName": "MSSupportGroup", // "resourceProviderName": { // "value": "microsoft.support", // "localizedValue": "microsoft.support" // }, // "operationId": "1e121103-0ba6-4300-ac9d-952bb5d0c80f", // "operationName": { // "value": "microsoft.support/supporttickets/write", // "localizedValue": "microsoft.support/supporttickets/write" // }, // "properties": { // "statusCode": "Created" // }, // "status": { // "value": "Succeeded", // "localizedValue": "Succeeded" // }, // "subStatus": { // "value": "Created", // "localizedValue": "Created (HTTP Status Code: 201)" // }, // "eventTimestamp": "2015-01-21T22:14:26.9792776Z", // "submissionTimestamp": "2015-01-21T22:14:39.9936304Z", // "subscriptionId": "089bd33f-d4ec-47fe-8ba5-0753aa5c5b33" // } // ], // "nextLink": "https://management.azure.com/########-####-####-####-############$skiptoken=######" // } // nextLink = CkJsonObjectW_stringOf(jsonResponse,L"nextLink"); i = 0; count_i = CkJsonObjectW_SizeOfArray(jsonResponse,L"value"); while (i < count_i) { CkJsonObjectW_putI(jsonResponse,i); authorizationAction = CkJsonObjectW_stringOf(jsonResponse,L"value[i].authorization.action"); authorizationRole = CkJsonObjectW_stringOf(jsonResponse,L"value[i].authorization.role"); authorizationScope = CkJsonObjectW_stringOf(jsonResponse,L"value[i].authorization.scope"); caller = CkJsonObjectW_stringOf(jsonResponse,L"value[i].caller"); claimsAud = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.aud"); claimsIss = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.iss"); claimsIat = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.iat"); claimsNbf = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.nbf"); claimsExp = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.exp"); claimsVer = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.ver"); claims_identity_claims_tenantid = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.microsoft.com/identity/claims/tenantid\""); claims_claims_authnmethodsreferences = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.microsoft.com/claims/authnmethodsreferences\""); claims_identity_claims_objectidentifier = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.microsoft.com/identity/claims/objectidentifier\""); claims_ws_2005_05_identity_claims_upn = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn\""); claimsPuid = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.puid"); claims_ws_2005_05_identity_claims_nameidentifier = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\""); claims_ws_2005_05_identity_claims_givenname = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname\""); claims_ws_2005_05_identity_claims_surname = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname\""); claimsName = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.name"); claimsGroups = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.groups"); claims_ws_2005_05_identity_claims_name = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name\""); claimsAppid = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.appid"); claimsAppidacr = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.appidacr"); claims_identity_claims_scope = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.microsoft.com/identity/claims/scope\""); claims_claims_authnclassreference = CkJsonObjectW_stringOf(jsonResponse,L"value[i].claims.\"http://schemas.microsoft.com/claims/authnclassreference\""); correlationId = CkJsonObjectW_stringOf(jsonResponse,L"value[i].correlationId"); description = CkJsonObjectW_stringOf(jsonResponse,L"value[i].description"); eventDataId = CkJsonObjectW_stringOf(jsonResponse,L"value[i].eventDataId"); eventNameValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].eventName.value"); eventNameLocalizedValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].eventName.localizedValue"); httpRequestClientRequestId = CkJsonObjectW_stringOf(jsonResponse,L"value[i].httpRequest.clientRequestId"); httpRequestClientIpAddress = CkJsonObjectW_stringOf(jsonResponse,L"value[i].httpRequest.clientIpAddress"); httpRequestMethod = CkJsonObjectW_stringOf(jsonResponse,L"value[i].httpRequest.method"); id = CkJsonObjectW_stringOf(jsonResponse,L"value[i].id"); level = CkJsonObjectW_stringOf(jsonResponse,L"value[i].level"); resourceGroupName = CkJsonObjectW_stringOf(jsonResponse,L"value[i].resourceGroupName"); resourceProviderNameValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].resourceProviderName.value"); resourceProviderNameLocalizedValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].resourceProviderName.localizedValue"); operationId = CkJsonObjectW_stringOf(jsonResponse,L"value[i].operationId"); operationNameValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].operationName.value"); operationNameLocalizedValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].operationName.localizedValue"); propertiesStatusCode = CkJsonObjectW_stringOf(jsonResponse,L"value[i].properties.statusCode"); statusValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].status.value"); statusLocalizedValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].status.localizedValue"); subStatusValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].subStatus.value"); subStatusLocalizedValue = CkJsonObjectW_stringOf(jsonResponse,L"value[i].subStatus.localizedValue"); eventTimestamp = CkJsonObjectW_stringOf(jsonResponse,L"value[i].eventTimestamp"); submissionTimestamp = CkJsonObjectW_stringOf(jsonResponse,L"value[i].submissionTimestamp"); subscriptionId = CkJsonObjectW_stringOf(jsonResponse,L"value[i].subscriptionId"); i = i + 1; } CkHttpW_Dispose(http); CkJsonObjectW_Dispose(jsonToken); CkJsonObjectW_Dispose(jsonResponse); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.