PowerBuilder
PowerBuilder
HTTPS MWS List Orders (Amazon Marketplace Web Service)
See more HTTP Misc Examples
Send an HTTPS MWS ListOrders request to return a list of orders created or updated during a time frame.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Req
oleobject loo_Resp
li_Success = 0
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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
//
// Build the HTTP request.
loo_Req = create oleobject
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
// Add query params
loo_Req.AddParam("Action","ListOrders")
loo_Req.AddParam("CreatedAfter","2016-12-31T23:00:00Z")
loo_Req.AddParam("MarketplaceId.Id.1","MWS_MARKETPLACE_ID")
loo_Req.AddParam("SellerId","MWS_SELLER_ID")
loo_Req.AddParam("AWSAccessKeyId","MWS_ACCESS_KEY_ID")
loo_Req.AddParam("SignatureVersion","2")
loo_Req.AddParam("SignatureMethod","HmacSHA256")
loo_Req.AddParam("Version","2013-09-01")
// Set the HTTP verb and path.
loo_Req.Path = "/Orders/2013-09-01"
loo_Req.HttpVerb = "POST"
// Add the MWS Signature after the verb, path, and all params have been set.
loo_Req.AddMwsSignature("mws.amazonservices.com","MWS_SECRET_ACCESS_KEY_ID")
loo_Req.ContentType = "application/x-www-form-urlencoded"
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
li_Success = loo_Http.HttpReq("https://mws.amazonservices.com/Orders/2013-09-01",loo_Req,loo_Resp)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
destroy loo_Resp
return
end if
if loo_Resp.StatusCode <> 200 then
Write-Debug "Non-success status code: " + string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Http
destroy loo_Req
destroy loo_Resp
return
end if
// Examine the XML returned in the response body.
Write-Debug loo_Resp.BodyStr
Write-Debug "----"
Write-Debug "Success."
destroy loo_Http
destroy loo_Req
destroy loo_Resp