PowerShell MWS Inbound: Get Preorder Info

Back to Index

Returns pre-order information, including dates, that a seller needs before confirming a shipment for pre-order. Also indicates if a shipment has already been confirmed for pre-order.

Documentation: http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetPreorderInfo.html

CURL Command

curl -X POST https://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01 \
  -d "AWSAccessKeyId=AWS_ACCESS_KEY_ID" \
  -d "Action=GetPreorderInfo" \
  -d "MWSAuthToken=MWS_AUTH_TOKEN" \
  -d "SellerId=MWS_SELLER_ID" \
  -d "SignatureVersion=2" \
  -d "Timestamp=CURRENT_DATE_TIME" \
  -d "Version=2010-10-01" \
  -d "Signature=MWS_SIGNATURE" \
  -d "SignatureMethod=HmacSHA256" \
  -d "ShipmentId=FBA2F3KCQF"

PowerShell Example

[Reflection.Assembly]::LoadFile("C:\myAssemblies\ChilkatDotNet2.dll")

$rest = New-Object Chilkat.Rest

#  URL: https://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01
$bTls = $true
$port = 443
$bAutoReconnect = $true
$success = $rest.Connect("mws.amazonaws.com",$port,$bTls,$bAutoReconnect)
if ($success -ne $true) {
    $("ConnectFailReason: " + $rest.ConnectFailReason)
    $($rest.LastErrorText)
    exit
}

$rest.AddQueryParam("AWSAccessKeyId","AWS_ACCESS_KEY_ID")
$rest.AddQueryParam("Action","GetPreorderInfo")
$rest.AddQueryParam("MWSAuthToken","MWS_AUTH_TOKEN")
$rest.AddQueryParam("SellerId","MWS_SELLER_ID")
$rest.AddQueryParam("SignatureVersion","2")
$rest.AddQueryParam("Version","2010-10-01")
$rest.AddQueryParam("SignatureMethod","HmacSHA256")
$rest.AddQueryParam("ShipmentId","FBA2F3KCQF")

$rest.Host = "mws.amazonaws.com"
#  The AddMwsSignature method adds the Timestamp and Signature query params.
$rest.AddMwsSignature("POST","/FulfillmentInboundShipment/2010-10-01","mws.amazonaws.com","MWS_SECRET_KEY")

$strResponseBody = $rest.FullRequestFormUrlEncoded("POST","/FulfillmentInboundShipment/2010-10-01")
if ($rest.LastMethodSuccess -ne $true) {
    $($rest.LastErrorText)
    exit
}

$xmlResponse = New-Object Chilkat.Xml
$xmlResponse.LoadXml($strResponseBody)

$GetPreorderInfoResponse_xmlns = $xmlResponse.GetAttrValue("xmlns")
$ShipmentContainsPreorderableItems = $xmlResponse.GetChildContent("GetPreorderInfoResult|ShipmentContainsPreorderableItems")
$NeedByDate = $xmlResponse.GetChildContent("GetPreorderInfoResult|NeedByDate")
$ConfirmedFulfillableDate = $xmlResponse.GetChildContent("GetPreorderInfoResult|ConfirmedFulfillableDate")
$ShipmentConfirmedForPreorder = $xmlResponse.GetChildContent("GetPreorderInfoResult|ShipmentConfirmedForPreorder")
$RequestId = $xmlResponse.GetChildContent("ResponseMetadata|RequestId")

Sample XML Response Body

<?xml version="1.0" encoding="utf-8" ?>
<GetPreorderInfoResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
    <GetPreorderInfoResult>
        <ShipmentContainsPreorderableItems>true</ShipmentContainsPreorderableItems>
        <NeedByDate>2015-12-27</NeedByDate>
        <ConfirmedFulfillableDate>2015-12-31</ConfirmedFulfillableDate>
        <ShipmentConfirmedForPreorder>true</ShipmentConfirmedForPreorder>
    </GetPreorderInfoResult>
    <ResponseMetadata>
        <RequestId>4a1a7029-462b-4a27-a04c-4cbe0fd107e3</RequestId>
    </ResponseMetadata>
</GetPreorderInfoResponse>