Objective-C 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"

Objective-C Example

#import <CkoRest.h>
#import <NSString.h>
#import <CkoXml.h>

CkoRest *rest = [[CkoRest alloc] init];
BOOL success;

//  URL: https://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"mws.amazonaws.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
    NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
    NSLog(@"%@",rest.LastErrorText);
    return;
}

[rest AddQueryParam: @"AWSAccessKeyId" value: @"AWS_ACCESS_KEY_ID"];
[rest AddQueryParam: @"Action" value: @"GetPreorderInfo"];
[rest AddQueryParam: @"MWSAuthToken" value: @"MWS_AUTH_TOKEN"];
[rest AddQueryParam: @"SellerId" value: @"MWS_SELLER_ID"];
[rest AddQueryParam: @"SignatureVersion" value: @"2"];
[rest AddQueryParam: @"Version" value: @"2010-10-01"];
[rest AddQueryParam: @"SignatureMethod" value: @"HmacSHA256"];
[rest AddQueryParam: @"ShipmentId" value: @"FBA2F3KCQF"];

rest.Host = @"mws.amazonaws.com";
//  The AddMwsSignature method adds the Timestamp and Signature query params.
[rest AddMwsSignature: @"POST" uriPath: @"/FulfillmentInboundShipment/2010-10-01" domain: @"mws.amazonaws.com" mwsSecretKey: @"MWS_SECRET_KEY"];

NSString *strResponseBody = [rest FullRequestFormUrlEncoded: @"POST" uriPath: @"/FulfillmentInboundShipment/2010-10-01"];
if (rest.LastMethodSuccess != YES) {
    NSLog(@"%@",rest.LastErrorText);
    return;
}

CkoXml *xmlResponse = [[CkoXml alloc] init];
[xmlResponse LoadXml: strResponseBody];

NSString *GetPreorderInfoResponse_xmlns = 0;
NSString *tagPath = 0;
NSString *ShipmentContainsPreorderableItems = 0;
NSString *NeedByDate = 0;
NSString *ConfirmedFulfillableDate = 0;
NSString *ShipmentConfirmedForPreorder = 0;
NSString *RequestId = 0;

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>