Home Page
Services & Technology Sign Up Now! Vendor/Customer Login About SwiftCD Contact Us
 

 

SwiftCD HTTP Post Order Submission

SwiftCD offers a HTTP post tool that will accept industry standard XML transmissions as valid SwiftCD orders. The detailed format, as well as sample code, confirmation response and validation information is below.

HTTP Post Order Submission Format

<?xml version="1.0" encoding="UTF-8" ?>
<SwiftCDOrders CreateDt="12/1/2001 5:00pm" BatchId="100" SubmitterId="VendorIdentification" ContactInfo="cust@vendor.com">
     <Order>
          <CustomerId>NEWC</CustomerId> 
          <TransactionDate>9/5/2001 10:00am</TransactionDate> 
          <Items>
               <CD>
                    <TrackingId>20010307-860-1</TrackingId> 
                    <LabelId>1</LabelId> 
                    <PackageId>1</PackageId>
                    <Quantity>1</Quantity> 
                    <RegKeyTitle>Unlock Code</RegKeyTitle> 
                    <RegKey>12345</RegKey> 
                    <RegFileName>regkey.txt</RegFileName> 
                    <RegFileContent>1ansrinta0-6iae0y52345</RegFileContent> 
                    <Content>
                         <Product>
                              <ProductId>123456</ProductId> 
                              <Title>Shareware CD</Title> 
                         </Product>
                    </Content>
               </CD>
          </Items>
          <Shipping>
               <Method>1</Method> 
               <FirstName>Joe</FirstName> 
               <LastName>Consumer</LastName> 
               <Company>ABC Corporation</Company> 
               <Addr1>2295 Customer Way</Addr1> 
               <Addr2>Suite 100</Addr2> 
               <City>NoWhere</City> 
               <State>GA</State> 
               <Province></Province> 
               <Country>US</Country> 
               <Zip>30155</Zip> 
               <Email>email@thenet.com</Email> 
               <Phone>(800) 555-6699</Phone> 
          </Shipping>
     </Order>
</SwiftCDOrders>

Reserved XML characters - Please be sure to encode ("escape") reserved XML characters if you need to send them in your order.  

Character Name Escape Code
< less -than &lt;
> greater-than &gt;
& ampersand  &amp;
' single -quote &apos;
" double-quote  &quot;

Element

Level

Description

Multiple Occurrences?

Parent Element

Required

SwiftCDOrders

0

Root node for a batch of orders. 
CreateDt = Date Batch Created
BatchId = Unique Identifier for this batch
SubmitterId = Your CustomerId unless told otherwise by SwiftCD
ContactInfo = Email address or phone # of person(s) sending batch

1 per Transmission

Root

Yes

Order

1

Identifies 1 order for a given purchase

Unlimited per Batch

SwiftCDOrders

Yes

CustomerId

2

Your CustomerId/Logon created when you signed up for SwiftCD services

1 per order

Order

Yes

TransactionDate

2

Date and time this order transaction occurred.  This is for your reference only, translates to OrderDate in OrderStatus.
Format:  mm/dd/ccyy hh:mm:ss AM/PM

1 per order

Order

Yes

Items

2

Identifies Grouping for Products Ordered

1 per order

Order

Yes

CD

3

Identifies the Item as a CD

Unlimited per Items

Items

Yes

Fulfillment Item

3

Identifies the Item as a non-CD fulfillment item

Unlimited per Items

Items

Yes

TrackingId

1

Your unique tracking Id Number for this order.  This number is designated by you, and will be used for all tracking and reporting for this order.  We suggest a number which includes Date, Product ID, and a serial number.  Example:  20010115-34565-1  NOTE:  Items with the same TrackingId will be shipped together in one package.  If you want multiple items shipped together, be sure they have the same TrackingId

1 per CD/fulfillment item

Order

Yes

LabelId

4

Label Id for this CD as previously defined in the SwiftCD Vendor Area – Design CDs

1 per CD

CD

Yes

PackageId

4

Package Id for this CD as previously defined in the SwiftCD Vendor Area – Design CDs

1 per CD

CD

Yes

Mailer

4

Used only for printing on lightweight dynamic mailers

1 per CD

CD

No

Text

5

Text fields for printing on lightweight dynamic mailers

1 per Mailer

Mailer

No

Line

6

Text for printing on lightweight mailers.  Maximum 35 characters per Line, maximum 6 Lines.  Blank Line tag = blank printed line on mailer.

6 per Text

Mailer

No

Quantity

4

The number of copies ordered of this CD in this order

1 per CD/fulfillment item

CD

Yes

RegKeyTitle

4

Line 1 of the registration label.  Example: Unlock Code (maximum 60 characters per line)  Note:  #|# (pound-pipe-pound) will create a line feed on the printed label, maximum one line feed per entry.

1 per CD

CD

No

RegKey

4

Line 2 of the registration label. Example: 12345  (maximum 60 characters per line)  Note:  #|# (pound-pipe-pound) will create a line feed on the printed label, maximum one line feed per entry.

1 per CD

CD

No

RegFileName

4

Software registration file, written to root of CD

1 per CD

CD

No

RegFileContent

4

Text content of registration file, may include line feeds, maximum 5000 characters

1 per CD

CD

No

Content

4

Identifies the definition of content on the CD

1 per CD

CD

Yes

Product

5

Identifies a content item as Product

Unlimited per Content up to maximum storage capacity of CD, *or* 1 per fulfillment item

Content

Yes

ProductId

6

ProductId (PID) identifying product to SwiftCD (must be unique per CD)

1 per Product

Product

Yes

Title

6

Title of product.  If you have chosen this option in your label configuration, this text will be written on the CD at the time of production.  Used for CDs containing a single PID.

1 per Product

Product

No

Shipping

2

Identifies the product shipping information.

1 per Order

Order

Yes

Method

3

1=USPS First Class/Air Mail  
3=USPS Priority/Global Priority Mail
4=
UPS Ground (US only)
5=
UPS NextDay Air (US only)
6=
UPS WorldwideExpress
7=
UPS 2nd Day Air (US only)
8=UPS 3rd Day Air (US only)

1 per Shipping

Shipping

No

FirstName

3

FirstName of person to ship order to

1 per Shipping

Shipping

Yes

LastName

3

LastName of person to ship order to

1 per Shipping

Shipping

No

Company

3

Company name to ship order to

1 per Shipping

Shipping

No

Addr1

3

Street address to ship order to

1 per Shipping

Shipping

Yes

Addr2

3

Suite or Apartment Number of shipping address

1 per Shipping

Shipping

No

City

3

City of shipping address

1 per Shipping

Shipping

Yes

State

3

State Abbreviation, required if Country is US.
http://www.swiftcd.com/faq/State_codes.txt

1 per Shipping

Shipping

Yes

Province

3

Province if Country is not US, required if country is Canada.
http://www.swiftcd.com/faq/Canadian_provinces.txt

1 per Shipping

Shipping

No

Country

3

Country Code as defined by United States Postal Service
http://www.swiftcd.com/faq/Country_codes.txt

1 per Shipping

Shipping

Yes

Zip

3

Postal Code of shipping address

1 per Shipping

Shipping

Yes

Email

3

Email address of person receiving order at shipping address

1 per Shipping

Shipping

No

Phone

3

Phone number of person receiving order at shipping address

1 per Shipping

Shipping

No


Submitting Your HTTP Post Batch to SwiftCD

After creating your SwiftCDOrders batch you can submit the batch to SwiftCD using a Standard HTTP Posting Method. The web service is available at http://www.swiftcd.com/Orders/SubmitOrders.asp

An excellent XML help document can be found here.

To send test orders, replace <Order> with <Order Test="Y" >  You will receive live responses to your HTTP post, but the order will not actually enter our production stream.

IMPORTANT:  Before you will be able to send HTTP Post orders, we must authorize your IP.  Please send us a message here, and let us know your CustomerID and the IP that you will be using to send HTTP Post orders.  If your IP is inactive for three months (no orders received for three months), we will remove your IP from the access list.  If you find that you are denied access, please let us know if you would like your IP reactivated.


Sample Code

Visual Basic and Active Server Pages Example

Function PostOrdersToSwiftCD()
Dim xmlDoc
Dim xmlHTTP 
Dim ConfirmationXML
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = False
xmlDoc.Load “C:\SwiftCDOrders.XML”
Set xmlHTTP = CreateObject("Microsoft.XMLHttp") 
xmlHTTP.Open "POST", “http://www.swiftcd.com/Orders/SubmitOrders.asp”, False 
xmlHTTP.send xmlDoc.xml 
ConfirmationXML = xmlHTTP.responseXML.xml 
Set xmlDoc = Nothing 
Set xmlHTTP = Nothing

End Function

Sample Perl Script (click here)

Sample PHP Script (click here)

Note to Linux Users:

Our server requires DOS line endings.  If you are getting a Bad Request error, before you send data, you may want to replace every instance of  "\n" with "\r\n"

Confirmation Response

After transmitting your HTTP Post batch to SwiftCD you will receive a response XML string that will contain the following:

<SwiftCDBatchResult>
<Success>Y</Success>
<Errors></Errors>
<TotalOrders>1</TotalOrders>
<TotalItems>2</TotalItems>
</SwiftCDBatchResult>

Response Element Descriptions
Success = “Y” or “N”
Errors = List of problems with the transmission
TotalOrders = Total count of Orders Element in transmission
TotalItems = Total count of CD Element in transmission

If Success = “Y” then you have successfully transmitted your orders to SwiftCD. If Success=”N” then please correct the errors specified in the <Errors> element.  The following is a list of the conditions that will cause an error:

Missing <TrackingId>
Missing <CustomerId>
Missing <LabelId>
Missing <PackageId>
Missing <Quantity>
Missing <ProductId>
Missing <FirstName>
Missing <Addr1>
Missing <City>
If country is US, missing or invalid <State>
Missing or invalid <Country>
Missing <Zip>

Could Not Load XML Error or XML Parsing Errors
Recommended Steps To Resolve XML Transmission and Parsing Errors

  • 1. Calling code must send xml in form part of http post per RFC 1867 ( http://www.w3.org/TR/device-upload ) .
  • 2. Check for Reserved XML Characters  ( see Reserved Characters listed above. )
  • 3. If you are running on Linux check for line endings.  Our server requires DOS line endings.  Replace every instance of "\n" with "\r\n".
  • 4. Check your HTTP protocol being used ( 1.0 or 1.1 ) ( http://www.w3.org/Protocols/ ). Our server uses HTTP 1.1 protocol.
  • 5. Compare your calling source code to the working examples listed on this page.

    Order Tracking
    XML Orders are loaded into our system every 30 minutes. If you cannot track your order 30 minutes after transmitting your xml please verify the <Order><CustomerId> element contains your SwiftCD customerid/vendor login. If it does not match please correct your xml file and transmit again.




    Questions?  Please ask them here.
  •    
    back to top