Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Unicode C Web API Examples

Primary Categories

ABN AMRO
AWS Translate
Activix CRM
Adyen
Amazon MWS
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bitfinex v2 REST
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Jira
MYOB
Magento

MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
Rabobank
SOAP finkok.com
Shippo
Shopify
SimpleTexting
Square
Stripe
SugarCRM
Trello
Twilio
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
WhatsApp
WooCommerce
Xero
Yousign
_Miscellaneous_
eBay
effectconnect

 

 

 

(Unicode C) Azure List Storage Accounts

Demonstrates how to list Azure storage accounts.

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    HCkJsonObjectW jsonToken;
    BOOL success;
    const wchar_t *url;
    const wchar_t *jsonResp;
    HCkJsonObjectW json;
    int i;
    int count_i;
    const wchar_t *skuName;
    const wchar_t *skuTier;
    const wchar_t *kind;
    const wchar_t *id;
    const wchar_t *name;
    const wchar_t *v_type;
    const wchar_t *location;
    const wchar_t *propertiesNetworkAclsBypass;
    const wchar_t *propertiesNetworkAclsDefaultAction;
    BOOL propertiesSupportsHttpsTrafficOnly;
    BOOL propertiesEncryptionServicesFileEnabled;
    const wchar_t *propertiesEncryptionServicesFileLastEnabledTime;
    BOOL propertiesEncryptionServicesBlobEnabled;
    const wchar_t *propertiesEncryptionServicesBlobLastEnabledTime;
    const wchar_t *propertiesEncryptionKeySource;
    const wchar_t *propertiesProvisioningState;
    const wchar_t *propertiesCreationTime;
    const wchar_t *propertiesPrimaryEndpointsBlob;
    const wchar_t *propertiesPrimaryEndpointsQueue;
    const wchar_t *propertiesPrimaryEndpointsTable;
    const wchar_t *propertiesPrimaryEndpointsFile;
    const wchar_t *propertiesPrimaryLocation;
    const wchar_t *propertiesStatusOfPrimary;

    // 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");

    url = L"https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts?api-version=2018-11-01";

    jsonResp = CkHttpW_quickGetStr(http,url);
    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",CkHttpW_getLastStatus(http));

    json = CkJsonObjectW_Create();
    CkJsonObjectW_Load(json,jsonResp);
    CkJsonObjectW_putEmitCompact(json,FALSE);
    wprintf(L"%s\n",CkJsonObjectW_emit(json));

    if (CkHttpW_getLastStatus(http) != 200) {
        wprintf(L"Failed.\n");
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(jsonToken);
        CkJsonObjectW_Dispose(json);
        return;
    }

    // Sample output...
    // (See the parsing code below..)
    // 
    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    // {
    //   "value": [
    //     {
    //       "sku": {
    //         "name": "Standard_LRS",
    //         "tier": "Standard"
    //       },
    //       "kind": "Storage",
    //       "id": "/subscriptions/6c42643b-ebef-45e0-b917-b3583b84a57f/resourceGroups/gchilkat/providers/Microsoft.Storage/storageAccounts/chilkat",
    //       "name": "chilkat",
    //       "type": "Microsoft.Storage/storageAccounts",
    //       "location": "eastus",
    //       "tags": {},
    //       "properties": {
    //         "networkAcls": {
    //           "bypass": "AzureServices",
    //           "virtualNetworkRules": [
    //           ],
    //           "ipRules": [
    //           ],
    //           "defaultAction": "Allow"
    //         },
    //         "supportsHttpsTrafficOnly": true,
    //         "encryption": {
    //           "services": {
    //             "file": {
    //               "enabled": true,
    //               "lastEnabledTime": "2017-12-28T11:02:10.6840887Z"
    //             },
    //             "blob": {
    //               "enabled": true,
    //               "lastEnabledTime": "2017-12-28T11:02:10.6840887Z"
    //             }
    //           },
    //           "keySource": "Microsoft.Storage"
    //         },
    //         "provisioningState": "Succeeded",
    //         "creationTime": "2016-04-18T22:57:36.5377065Z",
    //         "primaryEndpoints": {
    //           "blob": "https://chilkat.blob.core.windows.net/",
    //           "queue": "https://chilkat.queue.core.windows.net/",
    //           "table": "https://chilkat.table.core.windows.net/",
    //           "file": "https://chilkat.file.core.windows.net/"
    //         },
    //         "primaryLocation": "eastus",
    //         "statusOfPrimary": "available"
    //       }
    //     }
    //   ]
    // }
    // 

    i = 0;
    count_i = CkJsonObjectW_SizeOfArray(json,L"value");
    while (i < count_i) {
        CkJsonObjectW_putI(json,i);
        skuName = CkJsonObjectW_stringOf(json,L"value[i].sku.name");
        skuTier = CkJsonObjectW_stringOf(json,L"value[i].sku.tier");
        kind = CkJsonObjectW_stringOf(json,L"value[i].kind");
        id = CkJsonObjectW_stringOf(json,L"value[i].id");
        name = CkJsonObjectW_stringOf(json,L"value[i].name");
        v_type = CkJsonObjectW_stringOf(json,L"value[i].type");
        location = CkJsonObjectW_stringOf(json,L"value[i].location");
        propertiesNetworkAclsBypass = CkJsonObjectW_stringOf(json,L"value[i].properties.networkAcls.bypass");
        propertiesNetworkAclsDefaultAction = CkJsonObjectW_stringOf(json,L"value[i].properties.networkAcls.defaultAction");
        propertiesSupportsHttpsTrafficOnly = CkJsonObjectW_BoolOf(json,L"value[i].properties.supportsHttpsTrafficOnly");
        propertiesEncryptionServicesFileEnabled = CkJsonObjectW_BoolOf(json,L"value[i].properties.encryption.services.file.enabled");
        propertiesEncryptionServicesFileLastEnabledTime = CkJsonObjectW_stringOf(json,L"value[i].properties.encryption.services.file.lastEnabledTime");
        propertiesEncryptionServicesBlobEnabled = CkJsonObjectW_BoolOf(json,L"value[i].properties.encryption.services.blob.enabled");
        propertiesEncryptionServicesBlobLastEnabledTime = CkJsonObjectW_stringOf(json,L"value[i].properties.encryption.services.blob.lastEnabledTime");
        propertiesEncryptionKeySource = CkJsonObjectW_stringOf(json,L"value[i].properties.encryption.keySource");
        propertiesProvisioningState = CkJsonObjectW_stringOf(json,L"value[i].properties.provisioningState");
        propertiesCreationTime = CkJsonObjectW_stringOf(json,L"value[i].properties.creationTime");
        propertiesPrimaryEndpointsBlob = CkJsonObjectW_stringOf(json,L"value[i].properties.primaryEndpoints.blob");
        propertiesPrimaryEndpointsQueue = CkJsonObjectW_stringOf(json,L"value[i].properties.primaryEndpoints.queue");
        propertiesPrimaryEndpointsTable = CkJsonObjectW_stringOf(json,L"value[i].properties.primaryEndpoints.table");
        propertiesPrimaryEndpointsFile = CkJsonObjectW_stringOf(json,L"value[i].properties.primaryEndpoints.file");
        propertiesPrimaryLocation = CkJsonObjectW_stringOf(json,L"value[i].properties.primaryLocation");
        propertiesStatusOfPrimary = CkJsonObjectW_stringOf(json,L"value[i].properties.statusOfPrimary");
        i = i + 1;
    }



    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(jsonToken);
    CkJsonObjectW_Dispose(json);

    }

 

© 2000-2020 Chilkat Software, Inc. All Rights Reserved.