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

Visual FoxPro 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
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

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
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
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

 

 

 

(Visual FoxPro) Amazon SP-API Get Orders

See more Amazon SP-API Examples

Demonstrates Amazon SP-API Sellers API -- get orders. Returns orders created or updated during the time frame indicated by the specified parameters.

For more information, see https://developer-docs.amazon.com/sp-api/docs/orders-api-v0-reference#getorders

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

LOCAL loAuthAws
LOCAL loRest
LOCAL lnBTls
LOCAL lnPort
LOCAL lnBAutoReconnect
LOCAL lnSuccess
LOCAL loJsonToken
LOCAL lcRdt_token
LOCAL loSbResponse
LOCAL lcUri
LOCAL lnStatusCode
LOCAL loJson
LOCAL lcAmazonOrderId
LOCAL lcPurchaseDate
LOCAL lcLastUpdateDate
LOCAL lcOrderStatus
LOCAL lcFulfillmentChannel
LOCAL lcSalesChannel
LOCAL lcShipServiceLevel
LOCAL lcCurrencyCode
LOCAL lcAmount
LOCAL lnNumberOfItemsShipped
LOCAL lnNumberOfItemsUnshipped
LOCAL lcPaymentMethod
LOCAL lnIsReplacementOrder
LOCAL lcMarketplaceId
LOCAL lcShipmentServiceLevelCategory
LOCAL lcOrderType
LOCAL lcEarliestShipDate
LOCAL lcLatestShipDate
LOCAL lcEarliestDeliveryDate
LOCAL lcLatestDeliveryDate
LOCAL lnIsBusinessOrder
LOCAL lnIsPrime
LOCAL lnIsGlobalExpressEnabled
LOCAL lnIsPremiumOrder
LOCAL lnIsSoldByAB
LOCAL lnIsIBA
LOCAL lcName
LOCAL lcAddressLine1
LOCAL lcCity
LOCAL lcStateOrRegion
LOCAL lcPostalCode
LOCAL lcCountryCode
LOCAL lcPhone
LOCAL lcAddressType
LOCAL lcFulfillmentSupplySourceId
LOCAL lnIsISPU
LOCAL lnIsAccessPointOrder
LOCAL lnHasAutomatedShippingSettings
LOCAL lcEasyShipShipmentStatus
LOCAL lcElectronicInvoiceStatus
LOCAL j
LOCAL lnCount_j
LOCAL lcStrVal
LOCAL lcCreatedBefore
LOCAL i
LOCAL lnCount_i

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

* IMPORTANT:
* You'll need to make changes to use values specific to your own region and account.
* 
* Here is a list of values you'll need to change or provide:
* 
* 1) The access key. Change AWS_ACCESS_KEY to your actual access key.
* 2) The secret key. Change AWS_SECRET_KEY to your actual access key.
* 3) Your region.  Change "ew-west-1" to your region.
* 4) The domain to which you connect.  Change sandbox.sellingpartnerapi-eu.amazon.com to non-sandbox by removing the "sandbox." 
*    and change the "-eu" part of the domain to your region. See https://developer-docs.amazon.com/sp-api/docs/sp-api-endpoints
* 5) Use the restricted data token (RDT) obtained from your code that previously obtained the RDT.
* 	If you saved the RDT to a file, update the relative file path "qa_data/tokens/sp_api_rdt_token.json" to your actual file path.
* 6) Update your Marketplace ID(s), such as ATVPDKIKX0DER
* 7) If using the non-sandbox, change the CreatedAfter from "TEST_CASE_200" to an actual date, such as "2022-12-25"

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.AuthAws')
loAuthAws = CreateObject('Chilkat.AuthAws')
loAuthAws.AccessKey = "AWS_ACCESS_KEY"
loAuthAws.SecretKey = "AWS_SECRET_KEY"
loAuthAws.ServiceName = "execute-api"
* Use the region that is correct for your needs.
loAuthAws.Region = "eu-west-1"

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rest')
loRest = CreateObject('Chilkat.Rest')
lnBTls = 1
lnPort = 443
lnBAutoReconnect = 1
* Make sure to use the correct domain.
* This example is using the sandbox
lnSuccess = loRest.Connect("sandbox.sellingpartnerapi-eu.amazon.com",lnPort,lnBTls,lnBAutoReconnect)
IF (lnSuccess = 0) THEN
    ? loRest.LastErrorText
    RELEASE loAuthAws
    RELEASE loRest
    CANCEL
ENDIF

lnSuccess = loRest.SetAuthAws(loAuthAws)

* Here's the example to get the RDT access token: Get SP-API Restricted Data Token

* Load the previously obtained RDT access token.
* See Fetch SP-API RDT Access Token
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJsonToken = CreateObject('Chilkat.JsonObject')
lnSuccess = loJsonToken.LoadFile("qa_data/tokens/sp_api_rdt_token.json")
IF (lnSuccess = 0) THEN
    ? "Failed to load RDT access token."
    RELEASE loAuthAws
    RELEASE loRest
    RELEASE loJsonToken
    CANCEL
ENDIF

* Add the x-amz-access-token request header.
lcRdt_token = loJsonToken.StringOf("restrictedDataToken")
loRest.ClearAllHeaders()
loRest.AddHeader("x-amz-access-token",lcRdt_token)

* Indicate the marketplace IDs.  Use the marketplace ID for your needs. See https://developer-docs.amazon.com/sp-api/docs/marketplace-ids
loRest.ClearAllQueryParams()
* When using the sandbox, use these params literally and exactly has shown here:
loRest.AddQueryParam("MarketplaceIds","ATVPDKIKX0DER")
loRest.AddQueryParam("CreatedAfter","TEST_CASE_200")

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponse = CreateObject('Chilkat.StringBuilder')
lcUri = "/orders/v0/orders"
lnSuccess = loRest.FullRequestNoBodySb("GET",lcUri,loSbResponse)
IF (lnSuccess = 0) THEN
    ? loRest.LastErrorText
    RELEASE loAuthAws
    RELEASE loRest
    RELEASE loJsonToken
    RELEASE loSbResponse
    CANCEL
ENDIF

* Examine the response status.
lnStatusCode = loRest.ResponseStatusCode
IF (lnStatusCode <> 200) THEN
    ? "Response status text: " + loRest.ResponseStatusText
    ? "Response body: "
    ? loSbResponse.GetAsString()
    ? "Failed."
    RELEASE loAuthAws
    RELEASE loRest
    RELEASE loJsonToken
    RELEASE loSbResponse
    CANCEL
ENDIF

? loSbResponse.GetAsString()

* If successful, gets a JSON response such as the following:

* {
*   "payload": {
*     "CreatedBefore": "1.569521782042E9",
*     "Orders": [
*       {
*         "AmazonOrderId": "902-1845936-5435065",
*         "PurchaseDate": "1970-01-19T03:58:30Z",
*         "LastUpdateDate": "1970-01-19T03:58:32Z",
*         "OrderStatus": "Unshipped",
*         "FulfillmentChannel": "MFN",
*         "SalesChannel": "Amazon.com",
*         "ShipServiceLevel": "Std US D2D Dom",
*         "OrderTotal": {
*           "CurrencyCode": "USD",
*           "Amount": "11.01"
*         },
*         "NumberOfItemsShipped": 0,
*         "NumberOfItemsUnshipped": 1,
*         "PaymentMethod": "Other",
*         "PaymentMethodDetails": [
*           "Standard"
*         ],
*         "IsReplacementOrder": false,
*         "MarketplaceId": "ATVPDKIKX0DER",
*         "ShipmentServiceLevelCategory": "Standard",
*         "OrderType": "StandardOrder",
*         "EarliestShipDate": "1970-01-19T03:59:27Z",
*         "LatestShipDate": "1970-01-19T04:05:13Z",
*         "EarliestDeliveryDate": "1970-01-19T04:06:39Z",
*         "LatestDeliveryDate": "1970-01-19T04:15:17Z",
*         "IsBusinessOrder": false,
*         "IsPrime": false,
*         "IsGlobalExpressEnabled": false,
*         "IsPremiumOrder": false,
*         "IsSoldByAB": false,
*         "IsIBA": false,
*         "DefaultShipFromLocationAddress": {
*           "Name": "MFNIntegrationTestMerchant",
*           "AddressLine1": "2201 WESTLAKE AVE",
*           "City": "SEATTLE",
*           "StateOrRegion": "WA",
*           "PostalCode": "98121-2778",
*           "CountryCode": "US",
*           "Phone": "+1 480-386-0930 ext. 73824",
*           "AddressType": "Commercial"
*         },
*         "FulfillmentInstruction": {
*           "FulfillmentSupplySourceId": "sampleSupplySourceId"
*         },
*         "IsISPU": false,
*         "IsAccessPointOrder": false,
*         "AutomatedShippingSettings": {
*           "HasAutomatedShippingSettings": false
*         },
*         "EasyShipShipmentStatus": "PendingPickUp",
*         "ElectronicInvoiceStatus": "NotRequired"
*       },
*       {
*         "AmazonOrderId": "902-8745147-1934268",
*         "PurchaseDate": "1970-01-19T03:58:30Z",
*         "LastUpdateDate": "1970-01-19T03:58:32Z",
*         "OrderStatus": "Unshipped",
*         "FulfillmentChannel": "MFN",
*         "SalesChannel": "Amazon.com",
*         "ShipServiceLevel": "Std US D2D Dom",
*         "OrderTotal": {
*           "CurrencyCode": "USD",
*           "Amount": "11.01"
*         },
*         "NumberOfItemsShipped": 0,
*         "NumberOfItemsUnshipped": 1,
*         "PaymentMethod": "Other",
*         "PaymentMethodDetails": [
*           "Standard"
*         ],
*         "IsReplacementOrder": false,
*         "MarketplaceId": "ATVPDKIKX0DER",
*         "ShipmentServiceLevelCategory": "Standard",
*         "OrderType": "StandardOrder",
*         "EarliestShipDate": "1970-01-19T03:59:27Z",
*         "LatestShipDate": "1970-01-19T04:05:13Z",
*         "EarliestDeliveryDate": "1970-01-19T04:06:39Z",
*         "LatestDeliveryDate": "1970-01-19T04:15:17Z",
*         "IsBusinessOrder": false,
*         "IsPrime": false,
*         "IsAccessPointOrder": false,
*         "IsGlobalExpressEnabled": false,
*         "IsPremiumOrder": false,
*         "IsSoldByAB": false,
*         "IsIBA": false,
*         "EasyShipShipmentStatus": "PendingPickUp",
*         "ElectronicInvoiceStatus": "NotRequired"
*       }
*     ]
*   }
* }

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

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')

loJson.LoadSb(loSbResponse)

lcCreatedBefore = loJson.StringOf("payload.CreatedBefore")
i = 0
lnCount_i = loJson.SizeOfArray("payload.Orders")
DO WHILE i < lnCount_i
    loJson.I = i
    lcAmazonOrderId = loJson.StringOf("payload.Orders[i].AmazonOrderId")
    lcPurchaseDate = loJson.StringOf("payload.Orders[i].PurchaseDate")
    lcLastUpdateDate = loJson.StringOf("payload.Orders[i].LastUpdateDate")
    lcOrderStatus = loJson.StringOf("payload.Orders[i].OrderStatus")
    lcFulfillmentChannel = loJson.StringOf("payload.Orders[i].FulfillmentChannel")
    lcSalesChannel = loJson.StringOf("payload.Orders[i].SalesChannel")
    lcShipServiceLevel = loJson.StringOf("payload.Orders[i].ShipServiceLevel")
    lcCurrencyCode = loJson.StringOf("payload.Orders[i].OrderTotal.CurrencyCode")
    lcAmount = loJson.StringOf("payload.Orders[i].OrderTotal.Amount")
    lnNumberOfItemsShipped = loJson.IntOf("payload.Orders[i].NumberOfItemsShipped")
    lnNumberOfItemsUnshipped = loJson.IntOf("payload.Orders[i].NumberOfItemsUnshipped")
    lcPaymentMethod = loJson.StringOf("payload.Orders[i].PaymentMethod")
    lnIsReplacementOrder = loJson.BoolOf("payload.Orders[i].IsReplacementOrder")
    lcMarketplaceId = loJson.StringOf("payload.Orders[i].MarketplaceId")
    lcShipmentServiceLevelCategory = loJson.StringOf("payload.Orders[i].ShipmentServiceLevelCategory")
    lcOrderType = loJson.StringOf("payload.Orders[i].OrderType")
    lcEarliestShipDate = loJson.StringOf("payload.Orders[i].EarliestShipDate")
    lcLatestShipDate = loJson.StringOf("payload.Orders[i].LatestShipDate")
    lcEarliestDeliveryDate = loJson.StringOf("payload.Orders[i].EarliestDeliveryDate")
    lcLatestDeliveryDate = loJson.StringOf("payload.Orders[i].LatestDeliveryDate")
    lnIsBusinessOrder = loJson.BoolOf("payload.Orders[i].IsBusinessOrder")
    lnIsPrime = loJson.BoolOf("payload.Orders[i].IsPrime")
    lnIsGlobalExpressEnabled = loJson.BoolOf("payload.Orders[i].IsGlobalExpressEnabled")
    lnIsPremiumOrder = loJson.BoolOf("payload.Orders[i].IsPremiumOrder")
    lnIsSoldByAB = loJson.BoolOf("payload.Orders[i].IsSoldByAB")
    lnIsIBA = loJson.BoolOf("payload.Orders[i].IsIBA")
    lcName = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.Name")
    lcAddressLine1 = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.AddressLine1")
    lcCity = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.City")
    lcStateOrRegion = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.StateOrRegion")
    lcPostalCode = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.PostalCode")
    lcCountryCode = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.CountryCode")
    lcPhone = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.Phone")
    lcAddressType = loJson.StringOf("payload.Orders[i].DefaultShipFromLocationAddress.AddressType")
    lcFulfillmentSupplySourceId = loJson.StringOf("payload.Orders[i].FulfillmentInstruction.FulfillmentSupplySourceId")
    lnIsISPU = loJson.BoolOf("payload.Orders[i].IsISPU")
    lnIsAccessPointOrder = loJson.BoolOf("payload.Orders[i].IsAccessPointOrder")
    lnHasAutomatedShippingSettings = loJson.BoolOf("payload.Orders[i].AutomatedShippingSettings.HasAutomatedShippingSettings")
    lcEasyShipShipmentStatus = loJson.StringOf("payload.Orders[i].EasyShipShipmentStatus")
    lcElectronicInvoiceStatus = loJson.StringOf("payload.Orders[i].ElectronicInvoiceStatus")
    j = 0
    lnCount_j = loJson.SizeOfArray("payload.Orders[i].PaymentMethodDetails")
    DO WHILE j < lnCount_j
        loJson.J = j
        lcStrVal = loJson.StringOf("payload.Orders[i].PaymentMethodDetails[j]")
        j = j + 1
    ENDDO
    i = i + 1
ENDDO

? "Success!"

RELEASE loAuthAws
RELEASE loRest
RELEASE loJsonToken
RELEASE loSbResponse
RELEASE loJson


 

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