Unicode C++ MWS Inbound: Get Transport Content

Back to Index

Returns current transportation information about an inbound shipment.

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

CURL Command

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

Unicode C++ Example

#include <CkRestW.h>
#include <CkXmlW.h>

void ChilkatSample(void)
    {
    CkRestW rest;
    bool success;

    //  URL: https://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01
    bool bTls = true;
    int port = 443;
    bool bAutoReconnect = true;
    success = rest.Connect(L"mws.amazonaws.com",port,bTls,bAutoReconnect);
    if (success != true) {
        wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    rest.AddQueryParam(L"AWSAccessKeyId",L"AWS_ACCESS_KEY_ID");
    rest.AddQueryParam(L"Action",L"GetTransportContent");
    rest.AddQueryParam(L"MWSAuthToken",L"MWS_AUTH_TOKEN");
    rest.AddQueryParam(L"SellerId",L"MWS_SELLER_ID");
    rest.AddQueryParam(L"SignatureVersion",L"2");
    rest.AddQueryParam(L"Version",L"2010-10-01");
    rest.AddQueryParam(L"SignatureMethod",L"HmacSHA256");
    rest.AddQueryParam(L"ShipmentId",L"FBAQ6QBP");

    rest.put_Host(L"mws.amazonaws.com");
    //  The AddMwsSignature method adds the Timestamp and Signature query params.
    rest.AddMwsSignature(L"POST",L"/FulfillmentInboundShipment/2010-10-01",L"mws.amazonaws.com",L"MWS_SECRET_KEY");

    const wchar_t *strResponseBody = rest.fullRequestFormUrlEncoded(L"POST",L"/FulfillmentInboundShipment/2010-10-01");
    if (rest.get_LastMethodSuccess() != true) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    CkXmlW xmlResponse;
    xmlResponse.LoadXml(strResponseBody);

    const wchar_t *GetTransportContentResponse_xmlns = 0;
    const wchar_t *tagPath = 0;
    const wchar_t *TrackingId = 0;
    const wchar_t *CarrierName = 0;
    const wchar_t *PackageStatus = 0;
    const wchar_t *TransportStatus = 0;
    const wchar_t *ShipmentType = 0;
    const wchar_t *ShipmentId = 0;
    const wchar_t *SellerId = 0;
    const wchar_t *IsPartnered = 0;
    const wchar_t *RequestId = 0;

    GetTransportContentResponse_xmlns = xmlResponse.getAttrValue(L"xmlns");
    TrackingId = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportDetails|NonPartneredSmallParcelData|PackageList|member|TrackingId");
    CarrierName = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportDetails|NonPartneredSmallParcelData|PackageList|member|CarrierName");
    PackageStatus = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportDetails|NonPartneredSmallParcelData|PackageList|member|PackageStatus");
    TransportStatus = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportResult|TransportStatus");
    ShipmentType = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportHeader|ShipmentType");
    ShipmentId = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportHeader|ShipmentId");
    SellerId = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportHeader|SellerId");
    IsPartnered = xmlResponse.getChildContent(L"GetTransportContentResult|TransportContent|TransportHeader|IsPartnered");
    RequestId = xmlResponse.getChildContent(L"ResponseMetadata|RequestId");
    }

Sample XML Response Body

<?xml version="1.0" encoding="utf-8" ?>
<GetTransportContentResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
    <GetTransportContentResult>
        <TransportContent>
            <TransportDetails>
                <NonPartneredSmallParcelData>
                    <PackageList>
                        <member>
                            <TrackingId>1Z6Y68W00342402864</TrackingId>
                            <CarrierName>UNITED PARCEL SERVICE INC</CarrierName>
                            <PackageStatus>SHIPPED</PackageStatus>
                        </member>
                    </PackageList>
                </NonPartneredSmallParcelData>
            </TransportDetails>
            <TransportResult>
                <TransportStatus>WORKING</TransportStatus>
            </TransportResult>
            <TransportHeader>
                <ShipmentType>SP</ShipmentType>
                <ShipmentId>FBAQ6QBP</ShipmentId>
                <SellerId>A135KKEKWF1J56</SellerId>
                <IsPartnered>false</IsPartnered>
            </TransportHeader>
        </TransportContent>
    </GetTransportContentResult>
    <ResponseMetadata>
        <RequestId>89a965c3-1af7-41e3-9152-44cf0affd34b</RequestId>
    </ResponseMetadata>
</GetTransportContentResponse>