Chilkat Examples

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

DataFlex Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(DataFlex) MWS SubmitFeed (Amazon Marketplace Web Service)

Uploads a feed for processing by Amazon MWS.

See Amazon MWS SubmitFeed for the Amazon MWS SubmitFeed reference documentation.

Important: The Chilkat v9.5.0.75 release accidentally breaks Amazon MWS (not AWS) authentication. If you need MWS with 9.5.0.75, send email to support@chilkatsoft.com for a hotfix, or revert back to v9.5.0.73, or update to a version after 9.5.0.75.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoXml
    Handle hoCrypt
    String sContentMd5Value
    Handle hoRest
    Boolean iBTls
    Integer iPort
    Boolean iBAutoReconnect
    String sResponseXml
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

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

    // This example will send an XML file in the HTTP request body.  
    // First we'll construct the XML, then we'll compute the MD5 digest which needs to be added as a query param..

    // Construct the following XML.   (This is just a sample XML body..)

    // <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    //     xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    //   <Header>
    //     <DocumentVersion>1.01</DocumentVersion>
    //     <MerchantIdentifier>M_EXAMPLE_123456</MerchantIdentifier>
    //   </Header>
    //   <MessageType>Product</MessageType>
    //   <PurgeAndReplace>false</PurgeAndReplace>
    //   <Message>
    //     <MessageID>1</MessageID>
    //     <OperationType>Update</OperationType>
    //     <Product>
    //       <SKU>56789</SKU>
    //       <StandardProductID>
    //         <Type>ASIN</Type>
    //         <Value>B0EXAMPLEG</Value>
    //       </StandardProductID>
    //       <ProductTaxCode>A_GEN_NOTAX</ProductTaxCode>
    //       <DescriptionData>
    //         <Title>Example Product Title</Title>
    //         <Brand>Example Product Brand</Brand>
    //         <Description>This is an example product description.</Description>
    //         <BulletPoint>Example Bullet Point 1</BulletPoint>
    //         <BulletPoint>Example Bullet Point 2</BulletPoint>
    //         <MSRP currency="USD">25.19</MSRP>
    //         <Manufacturer>Example Product Manufacturer</Manufacturer>
    //         <ItemType>example-item-type</ItemType>
    //       </DescriptionData>
    //       <ProductData>
    //         <Health>
    //           <ProductType>
    //             <HealthMisc>
    //               <Ingredients>Example Ingredients</Ingredients>
    //               <Directions>Example Directions</Directions>
    //             </HealthMisc>
    //           </ProductType>
    //         </Health>
    //       </ProductData>
    //     </Product>
    //   </Message>
    // </AmazonEnvelope>

    // This code was generated by pasting the above XML into the online tool at http://tools.chilkat.io/xmlCreate.cshtml
    Get Create (RefClass(cComChilkatXml)) To hoXml
    If (Not(IsComObjectCreated(hoXml))) Begin
        Send CreateComObject of hoXml
    End
    Set ComTag Of hoXml To "AmazonEnvelope"
    Get ComAddAttribute Of hoXml "xmlns:xsi" "http://www.w3.org/2001/XMLSchema-instance" To iSuccess
    Get ComAddAttribute Of hoXml "xsi:noNamespaceSchemaLocation" "amzn-envelope.xsd" To iSuccess
    Send ComUpdateChildContent To hoXml "Header|DocumentVersion" "1.01"
    Send ComUpdateChildContent To hoXml "Header|MerchantIdentifier" "M_EXAMPLE_123456"
    Send ComUpdateChildContent To hoXml "MessageType" "Product"
    Send ComUpdateChildContent To hoXml "PurgeAndReplace" "false"
    Send ComUpdateChildContent To hoXml "Message|MessageID" "1"
    Send ComUpdateChildContent To hoXml "Message|OperationType" "Update"
    Send ComUpdateChildContent To hoXml "Message|Product|SKU" "56789"
    Send ComUpdateChildContent To hoXml "Message|Product|StandardProductID|Type" "ASIN"
    Send ComUpdateChildContent To hoXml "Message|Product|StandardProductID|Value" "B0EXAMPLEG"
    Send ComUpdateChildContent To hoXml "Message|Product|ProductTaxCode" "A_GEN_NOTAX"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|Title" "Example Product Title"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|Brand" "Example Product Brand"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|Description" "This is an example product description."
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|BulletPoint" "Example Bullet Point 1"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|BulletPoint[1]" "Example Bullet Point 2"
    Get ComUpdateAttrAt Of hoXml "Message|Product|DescriptionData|MSRP" True "currency" "USD" To iSuccess
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|MSRP" "25.19"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|Manufacturer" "Example Product Manufacturer"
    Send ComUpdateChildContent To hoXml "Message|Product|DescriptionData|ItemType" "example-item-type"
    Send ComUpdateChildContent To hoXml "Message|Product|ProductData|Health|ProductType|HealthMisc|Ingredients" "Example Ingredients"
    Send ComUpdateChildContent To hoXml "Message|Product|ProductData|Health|ProductType|HealthMisc|Directions" "Example Directions"

    // Get the MD5 hash..
    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End
    Set ComHashAlgorithm Of hoCrypt To "md5"
    Get ComGetXml Of hoXml To sTemp1
    Get ComHashStringENC Of hoCrypt sTemp1 To sContentMd5Value

    Get Create (RefClass(cComChilkatRest)) To hoRest
    If (Not(IsComObjectCreated(hoRest))) Begin
        Send CreateComObject of hoRest
    End

    // Connect to the Amazon MWS REST server.
    // 
    // Make sure to connect to the correct Amazon MWS Endpoing, otherwise
    // you'll get an HTTP 401 response code.
    // 
    // The possible servers are:
    // 
    // North America (NA) 	https://mws.amazonservices.com
    // Europe (EU) 	https://mws-eu.amazonservices.com
    // India (IN) 	https://mws.amazonservices.in
    // China (CN) 	https://mws.amazonservices.com.cn
    // Japan (JP) 	https://mws.amazonservices.jp 
    // 
    Move True To iBTls
    Move 443 To iPort
    Move True To iBAutoReconnect
    Get ComConnect Of hoRest "mws.amazonservices.com" iPort iBTls iBAutoReconnect To iSuccess

    Set ComHost Of hoRest To "mws.amazonservices.com"

    Get ComAddQueryParam Of hoRest "AWSAccessKeyId" "0PB842ExampleN4ZTR2" To iSuccess
    Get ComAddQueryParam Of hoRest "Action" "SubmitFeed" To iSuccess
    Get ComAddQueryParam Of hoRest "FeedType" "_POST_PRODUCT_DATA_" To iSuccess
    Get ComAddQueryParam Of hoRest "MWSAuthToken" "amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE" To iSuccess
    Get ComAddQueryParam Of hoRest "MarketplaceId.Id.1" "ATVExampleDER" To iSuccess
    Get ComAddQueryParam Of hoRest "SellerId" "A1XExample5E6" To iSuccess
    Get ComAddQueryParam Of hoRest "ContentMD5Value" sContentMd5Value To iSuccess
    Get ComAddQueryParam Of hoRest "SignatureMethod" "HmacSHA256" To iSuccess
    Get ComAddQueryParam Of hoRest "SignatureVersion" "2" To iSuccess
    Get ComAddQueryParam Of hoRest "Version" "2009-01-01" To iSuccess

    // Add the MWS Signature param.  (Also adds the Timestamp parameter using the curent system date/time.)
    Get ComAddMwsSignature Of hoRest "POST" "/Feeds/2009-01-01" "mws.amazonservices.com" "MWS_SECRET_ACCESS_KEY_ID" To iSuccess

    Get ComAddHeader Of hoRest "Content-Type" "text/xml" To iSuccess
    Get ComGetXml Of hoXml To sTemp1
    Get ComFullRequestString Of hoRest "POST" "/Feeds/2009-01-01" sTemp1 To sResponseXml
    Get ComLastMethodSuccess Of hoRest To bTemp1
    If (bTemp1 <> True) Begin
        Get ComLastErrorText Of hoRest To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComResponseStatusCode Of hoRest To iTemp1
    If (iTemp1 <> 200) Begin
        // Examine the request/response to see what happened.
        Get ComResponseStatusCode Of hoRest To iTemp1
        Showln "response status code = " iTemp1
        Get ComResponseStatusText Of hoRest To sTemp1
        Showln "response status text = " sTemp1
        Get ComResponseHeader Of hoRest To sTemp1
        Showln "response header: " sTemp1
        Showln "response body: " sResponseXml
        Showln "---"
        Get ComLastRequestStartLine Of hoRest To sTemp1
        Showln "LastRequestStartLine: " sTemp1
        Get ComLastRequestHeader Of hoRest To sTemp1
        Showln "LastRequestHeader: " sTemp1
    End

    // Examine the XML returned in the response body.
    Showln sResponseXml
    Showln "----"
    Showln "Success."


End_Procedure

 

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