Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PowerBuilder) Azure Create Storage Account

Demonstrates how to create an Azure storage account.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
oleobject loo_Http
oleobject loo_JsonToken
integer li_Success
oleobject loo_JsonRequestBody
string ls_Url
oleobject loo_Resp
oleobject loo_Json
string ls_SkuName
string ls_SkuTier
string ls_Kind
string ls_Id
string ls_Name
string ls_V_type
string ls_Location
string ls_PropertiesNetworkAclsBypass
string ls_PropertiesNetworkAclsDefaultAction
integer li_PropertiesSupportsHttpsTrafficOnly
integer li_PropertiesEncryptionServicesFileEnabled
string ls_PropertiesEncryptionServicesFileLastEnabledTime
integer li_PropertiesEncryptionServicesBlobEnabled
string ls_PropertiesEncryptionServicesBlobLastEnabledTime
string ls_PropertiesEncryptionKeySource
string ls_PropertiesAccessTier
string ls_PropertiesProvisioningState
string ls_PropertiesCreationTime
string ls_PropertiesPrimaryEndpointsDfs
string ls_PropertiesPrimaryEndpointsWeb
string ls_PropertiesPrimaryEndpointsBlob
string ls_PropertiesPrimaryEndpointsQueue
string ls_PropertiesPrimaryEndpointsTable
string ls_PropertiesPrimaryEndpointsFile
string ls_PropertiesPrimaryLocation
string ls_PropertiesStatusOfPrimary
string ls_PropertiesSecondaryLocation
string ls_PropertiesStatusOfSecondary
integer i
integer li_Count_i

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Load an OAuth2 access token previously fetched by this example:  Get Azure OAuth2 Access Token
loo_JsonToken = create oleobject
li_rc = loo_JsonToken.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

li_Success = loo_JsonToken.LoadFile("qa_data/tokens/azureToken.json")
// Assuming success..
loo_Http.AuthToken = loo_JsonToken.StringOf("access_token")
Write-Debug "AuthToken: " + loo_Http.AuthToken

loo_Http.Accept = "application/json"

// Create the following JSON:

// {
//   "sku": {
//     "name": "Standard_GRS"
//   },
//   "kind": "StorageV2",
//   "location": "eastus2",
// }

// Use this online tool to generate the code from sample JSON: 
// Generate Code to Create JSON

loo_JsonRequestBody = create oleobject
li_rc = loo_JsonRequestBody.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JsonRequestBody.UpdateString("sku.name","Standard_GRS")
loo_JsonRequestBody.UpdateString("kind","StorageV2")
loo_JsonRequestBody.UpdateString("location","eastus2")

ls_Url = "https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}?api-version=2018-02-01"

loo_Resp = loo_Http.PText("PUT",ls_Url,loo_JsonRequestBody.Emit(),"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_JsonRequestBody
    return
end if

Write-Debug "Response Status Code: " + string(loo_Resp.StatusCode)

loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_Json.Load(loo_Resp.BodyStr)
loo_Json.EmitCompact = 0
Write-Debug loo_Json.Emit()

if loo_Resp.StatusCode >= 300 then
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_JsonToken
    destroy loo_JsonRequestBody
    destroy loo_Json
    return
end if

// Successful requests to create a new account return a 202 status code with an empty response body. The storage account is created asynchronously. 
// If the account already exists or is being provisioned, the request response has a 200 return code with the configuration of the existing storage account in the response body.
if loo_Resp.StatusCode = 202 then
    Write-Debug "Azure-AsyncOperation: " + loo_Resp.GetHeaderField("Azure-AsyncOperation")
end if

if loo_Resp.StatusCode = 200 then

    // Parse a response like this:

    // 	{
    // 	  "sku": {
    // 	    "name": "Standard_GRS",
    // 	    "tier": "Standard"
    // 	  },
    // 	  "kind": "StorageV2",
    // 	  "id": "/subscriptions/6c42643b-ebef-45f0-b917-b3583b84a57f/resourceGroups/gChilkat/providers/Microsoft.Storage/storageAccounts/chilkatsoftware",
    // 	  "name": "chilkatsoftware",
    // 	  "type": "Microsoft.Storage/storageAccounts",
    // 	  "location": "eastus2",
    // 	  "tags": {},
    // 	  "properties": {
    // 	    "networkAcls": {
    // 	      "bypass": "AzureServices",
    // 	      "virtualNetworkRules": [
    // 	      ],
    // 	      "ipRules": [
    // 	      ],
    // 	      "defaultAction": "Allow"
    // 	    },
    // 	    "supportsHttpsTrafficOnly": false,
    // 	    "encryption": {
    // 	      "services": {
    // 	        "file": {
    // 	          "enabled": true,
    // 	          "lastEnabledTime": "2019-05-14T22:18:33.2246670Z"
    // 	        },
    // 	        "blob": {
    // 	          "enabled": true,
    // 	          "lastEnabledTime": "2019-05-14T22:18:33.2246670Z"
    // 	        }
    // 	      },
    // 	      "keySource": "Microsoft.Storage"
    // 	    },
    // 	    "accessTier": "Hot",
    // 	    "provisioningState": "Succeeded",
    // 
    // 	    "creationTime": "2019-05-14T22:18:33.1309165Z",
    // 	    "primaryEndpoints": {
    // 	      "dfs": "https://chilkatsoftware.dfs.core.windows.net/",
    // 	      "web": "https://chilkatsoftware.z20.web.core.windows.net/",
    // 	      "blob": "https://chilkatsoftware.blob.core.windows.net/",
    // 	      "queue": "https://chilkatsoftware.queue.core.windows.net/",
    // 	      "table": "https://chilkatsoftware.table.core.windows.net/",
    // 	      "file": "https://chilkatsoftware.file.core.windows.net/"
    // 	    },
    // 	    "primaryLocation": "eastus2",
    // 	    "statusOfPrimary": "available",
    // 	    "secondaryLocation": "centralus",
    // 	    "statusOfSecondary": "available"
    // 	  }
    // 	}

    // Use this online tool to generate parsing code from sample JSON: 
    // Generate Parsing Code from JSON

    ls_SkuName = loo_Json.StringOf("sku.name")
    ls_SkuTier = loo_Json.StringOf("sku.tier")
    ls_Kind = loo_Json.StringOf("kind")
    ls_Id = loo_Json.StringOf("id")
    ls_Name = loo_Json.StringOf("name")
    ls_V_type = loo_Json.StringOf("type")
    ls_Location = loo_Json.StringOf("location")
    ls_PropertiesNetworkAclsBypass = loo_Json.StringOf("properties.networkAcls.bypass")
    ls_PropertiesNetworkAclsDefaultAction = loo_Json.StringOf("properties.networkAcls.defaultAction")
    li_PropertiesSupportsHttpsTrafficOnly = loo_Json.BoolOf("properties.supportsHttpsTrafficOnly")
    li_PropertiesEncryptionServicesFileEnabled = loo_Json.BoolOf("properties.encryption.services.file.enabled")
    ls_PropertiesEncryptionServicesFileLastEnabledTime = loo_Json.StringOf("properties.encryption.services.file.lastEnabledTime")
    li_PropertiesEncryptionServicesBlobEnabled = loo_Json.BoolOf("properties.encryption.services.blob.enabled")
    ls_PropertiesEncryptionServicesBlobLastEnabledTime = loo_Json.StringOf("properties.encryption.services.blob.lastEnabledTime")
    ls_PropertiesEncryptionKeySource = loo_Json.StringOf("properties.encryption.keySource")
    ls_PropertiesAccessTier = loo_Json.StringOf("properties.accessTier")
    ls_PropertiesProvisioningState = loo_Json.StringOf("properties.provisioningState")
    ls_PropertiesCreationTime = loo_Json.StringOf("properties.creationTime")
    ls_PropertiesPrimaryEndpointsDfs = loo_Json.StringOf("properties.primaryEndpoints.dfs")
    ls_PropertiesPrimaryEndpointsWeb = loo_Json.StringOf("properties.primaryEndpoints.web")
    ls_PropertiesPrimaryEndpointsBlob = loo_Json.StringOf("properties.primaryEndpoints.blob")
    ls_PropertiesPrimaryEndpointsQueue = loo_Json.StringOf("properties.primaryEndpoints.queue")
    ls_PropertiesPrimaryEndpointsTable = loo_Json.StringOf("properties.primaryEndpoints.table")
    ls_PropertiesPrimaryEndpointsFile = loo_Json.StringOf("properties.primaryEndpoints.file")
    ls_PropertiesPrimaryLocation = loo_Json.StringOf("properties.primaryLocation")
    ls_PropertiesStatusOfPrimary = loo_Json.StringOf("properties.statusOfPrimary")
    ls_PropertiesSecondaryLocation = loo_Json.StringOf("properties.secondaryLocation")
    ls_PropertiesStatusOfSecondary = loo_Json.StringOf("properties.statusOfSecondary")
end if

Write-Debug "Success."

destroy loo_Resp


destroy loo_Http
destroy loo_JsonToken
destroy loo_JsonRequestBody
destroy loo_Json

 

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