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

Tcl 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

 

 

 

(Tcl) Walmart V3 API - Get All Released Orders

Retrieves all the orders with line items that are in the "created" status, that is, these orders have been released from the Walmart Order Management System to the seller for processing. The released orders are the orders that are ready for a seller to fulfill.

For more information, see https://developer.walmart.com/#/apicenter/marketPlace/latest#getAllReleasedOrders

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

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

set http [new_CkHttp]

CkHttp_put_Accept $http "application/json"

# Setting the Login and Password properties to the clientId and clientSecret
# will cause the Basic Auth header to be added (i.e. BaseEncode64(clientId:clientSecret))
CkHttp_put_Login $http "clientId"
CkHttp_put_Password $http "clientSecret"
CkHttp_put_BasicAuth $http 1

CkHttp_SetRequestHeader $http "Content-Type" "application/json"
CkHttp_SetRequestHeader $http "WM_QOS.CORRELATION_ID" "b3261d2d-028a-4ef7-8602-633c23200af6"
# Use the access token obtained from this example:  Walmart v3 API Get OAuth2 Access Token using Client Credentials
CkHttp_SetRequestHeader $http "WM_SEC.ACCESS_TOKEN" "eyJraWQiOiIzZjVhYTFmNS1hYWE5LTQzM....."
CkHttp_SetRequestHeader $http "WM_SVC.NAME" "Walmart Marketplace"

CkHttp_SetUrlVar $http "createdStartDate" "2020-01-16T10:30:15Z"
CkHttp_SetUrlVar $http "limit" "200"
# Can also be 3PLFulfilled
CkHttp_SetUrlVar $http "shippingProgramType" "SellerFulfilled"
CkHttp_SetUrlVar $http "shipNodeType" "TWO_DAY"

# resp is a CkHttpResponse
set resp [CkHttp_QuickRequest $http "GET" "/v3/orders/released?createdStartDate={$createdStartDate}&limit={$limit}&shippingProgramType={$shippingProgramType}&shipNodeType={$shipNodeType}"]
if {[CkHttp_get_LastMethodSuccess $http] != 1} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

puts "Response Status Code: [CkHttpResponse_get_StatusCode $resp]"

set jsonResponse [new_CkJsonObject]

CkJsonObject_Load $jsonResponse [CkHttpResponse_bodyStr $resp]
CkJsonObject_put_EmitCompact $jsonResponse 0
puts [CkJsonObject_emit $jsonResponse]

if {[CkHttpResponse_get_StatusCode $resp] != 200} then {
    puts "Failed."
    delete_CkHttpResponse $resp

    delete_CkHttp $http
    delete_CkJsonObject $jsonResponse
    exit
}

delete_CkHttpResponse $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

# {
#   "list": {
#     "meta": {
#       "totalCount": 25228,
#       "limit": 10,
#       "nextCursor": "?limit=10&hasMoreElements=true&soIndex=25228&poIndex=10&sellerId=152&createdStartDate=2019-04-02T00:00:00.000Z&createdEndDate=2019-09-26T16:05:49.648Z"
#     },
#     "elements": {
#       "order": [
#         {
#           "purchaseOrderId": "4792701510371",
#           "customerOrderId": "5401973367419",
#           "customerEmailId": "47B81ACD2C62434DBE64F47B9E1F7630@relay.walmart.com",
#           "orderDate": 1569513584000,
#           "shippingInfo": {
#             "phone": "2134488377",
#             "estimatedDeliveryDate": 1569870000000,
#             "estimatedShipDate": 1569553200000,
#             "methodCode": "Express",
#             "postalAddress": {
#               "name": "Julio Hernandez",
#               "address1": "9713 pleasant view dr",
#               "address2": null,
#               "city": "Rancho Cucamonga",
#               "state": "CA",
#               "postalCode": "91701",
#               "country": "USA",
#               "addressType": "RESIDENTIAL"
#             }
#           },
#           "orderLines": {
#             "orderLine": [
#               {
#                 "lineNumber": "1",
#                 "item": {
#                   "productName": "Refurbished Lenovo YB1-X90F Grey Yoga Book with WiFi 10.1\" Touchscreen Tablet Android 6.0.1",
#                   "sku": "VO190403007727R"
#                 },
#                 "charges": {
#                   "charge": [
#                     {
#                       "chargeType": "PRODUCT",
#                       "chargeName": "ItemPrice",
#                       "chargeAmount": {
#                         "currency": "USD",
#                         "amount": 259
#                       },
#                       "tax": {
#                         "taxName": "Tax1",
#                         "taxAmount": {
#                           "currency": "USD",
#                           "amount": 20.07
#                         }
#                       }
#                     },
#                     {
#                       "chargeType": "FEE",
#                       "chargeName": "Fee",
#                       "chargeAmount": {
#                         "currency": "USD",
#                         "amount": 0
#                       },
#                       "tax": {
#                         "taxName": "Electronic Waste Recycling Fee",
#                         "taxAmount": {
#                           "currency": "USD",
#                           "amount": 5
#                         }
#                       }
#                     }
#                   ]
#                 },
#                 "orderLineQuantity": {
#                   "unitOfMeasurement": "EACH",
#                   "amount": "1"
#                 },
#                 "statusDate": 1569513724000,
#                 "orderLineStatuses": {
#                   "orderLineStatus": [
#                     {
#                       "status": "Acknowledged",
#                       "statusQuantity": {
#                         "unitOfMeasurement": "EACH",
#                         "amount": "1"
#                       },
#                       "cancellationReason": null,
#                       "trackingInfo": null,
#                       "returnCenterAddress": null
#                     }
#                   ]
#                 },
#                 "refund": null,
#                 "fulfillment": {
#                   "fulfillmentOption": "S2H",
#                   "shipMethod": "EXPEDITED",
#                   "storeId": null,
#                   "pickUpDateTime": 1569870000000,
#                   "pickUpBy": null,
#                   "shippingProgramType": "TWO_DAY"
#                 }
#               }
#             ]
#           },
#           "shipNode": {
#             "type": "3PLFulfilled"
#           }
#         }
#       ]
#     }
#   }
# }
# 

set listMetaTotalCount [CkJsonObject_IntOf $jsonResponse "list.meta.totalCount"]
set listMetaLimit [CkJsonObject_IntOf $jsonResponse "list.meta.limit"]
set listMetaNextCursor [CkJsonObject_stringOf $jsonResponse "list.meta.nextCursor"]
set i 0
set count_i [CkJsonObject_SizeOfArray $jsonResponse "list.elements.order"]
while {$i < $count_i} {
    CkJsonObject_put_I $jsonResponse $i
    set purchaseOrderId [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].purchaseOrderId"]
    set customerOrderId [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].customerOrderId"]
    set customerEmailId [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].customerEmailId"]
    set orderDate [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].orderDate"]
    set shippingInfoPhone [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.phone"]
    set shippingInfoEstimatedDeliveryDate [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].shippingInfo.estimatedDeliveryDate"]
    set shippingInfoEstimatedShipDate [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].shippingInfo.estimatedShipDate"]
    set shippingInfoMethodCode [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.methodCode"]
    set shippingInfoPostalAddressName [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.name"]
    set shippingInfoPostalAddressAddress1 [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.address1"]
    set shippingInfoPostalAddressAddress2 [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.address2"]
    set shippingInfoPostalAddressCity [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.city"]
    set shippingInfoPostalAddressState [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.state"]
    set shippingInfoPostalAddressPostalCode [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.postalCode"]
    set shippingInfoPostalAddressCountry [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.country"]
    set shippingInfoPostalAddressAddressType [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shippingInfo.postalAddress.addressType"]
    set shipNodeType [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].shipNode.type"]
    set j 0
    set count_j [CkJsonObject_SizeOfArray $jsonResponse "list.elements.order[i].orderLines.orderLine"]
    while {$j < $count_j} {
        CkJsonObject_put_J $jsonResponse $j
        set lineNumber [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].lineNumber"]
        set itemProductName [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].item.productName"]
        set itemSku [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].item.sku"]
        set orderLineQuantityUnitOfMeasurement [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.unitOfMeasurement"]
        set orderLineQuantityAmount [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineQuantity.amount"]
        set statusDate [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].statusDate"]
        set refund [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].refund"]
        set fulfillmentFulfillmentOption [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.fulfillmentOption"]
        set fulfillmentShipMethod [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.shipMethod"]
        set fulfillmentStoreId [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.storeId"]
        set fulfillmentPickUpDateTime [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpDateTime"]
        set fulfillmentPickUpBy [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.pickUpBy"]
        set fulfillmentShippingProgramType [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].fulfillment.shippingProgramType"]
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jsonResponse $k
            set chargeType [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeType"]
            set chargeName [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeName"]
            set chargeAmountCurrency [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.currency"]
            set chargeAmountAmount [CkJsonObject_IntOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].chargeAmount.amount"]
            set taxTaxName [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxName"]
            set taxTaxAmountCurrency [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.currency"]
            set taxTaxAmountAmount [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].charges.charge[k].tax.taxAmount.amount"]
            set k [expr $k + 1]
        }
        set k 0
        set count_k [CkJsonObject_SizeOfArray $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus"]
        while {$k < $count_k} {
            CkJsonObject_put_K $jsonResponse $k
            set status [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].status"]
            set statusQuantityUnitOfMeasurement [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.unitOfMeasurement"]
            set statusQuantityAmount [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].statusQuantity.amount"]
            set cancellationReason [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].cancellationReason"]
            set trackingInfo [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].trackingInfo"]
            set returnCenterAddress [CkJsonObject_stringOf $jsonResponse "list.elements.order[i].orderLines.orderLine[j].orderLineStatuses.orderLineStatus[k].returnCenterAddress"]
            set k [expr $k + 1]
        }
        set j [expr $j + 1]
    }
    set i [expr $i + 1]
}

delete_CkHttp $http
delete_CkJsonObject $jsonResponse

 

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