Difference between revisions of "USA Web Service"

From Netsville Support
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 19: Line 19:
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/login</code>
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/login</code>
  
* '''Expected XML'''
+
* '''XML Request'''
 
  <code>
 
  <code>
 
  <MemberRequest>
 
  <MemberRequest>
Line 57: Line 57:
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/shipping</code>
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/shipping</code>
  
* '''Expected XML'''
+
* '''XML Request'''
 
  <code>
 
  <code>
 
  <ShippingRequest>
 
  <ShippingRequest>
Line 63: Line 63:
 
     <ProductIDs>
 
     <ProductIDs>
 
       <ProductID qty="1">HK6614</ProductID>
 
       <ProductID qty="1">HK6614</ProductID>
       <ProductID qty="3">HJ2722</ProductID>
+
       <ProductID qty="3" opt="S-RED">HJ2722</ProductID>
 
     </ProductIDs>
 
     </ProductIDs>
 
  </ShippingRequest>
 
  </ShippingRequest>
 
  </code>
 
  </code>
 +
 +
NOTE: Specify options to products with the '''opt''' parameter separated by a dash(-).  In the example above, two options are being set with the product '''HJ2722''': '''S''' - Small, '''RED''' - For the color RED.
  
 
* '''XML Response'''
 
* '''XML Response'''
Line 89: Line 91:
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/tax</code>
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/tax</code>
  
* '''Expected XML'''
+
* '''XML Request'''
 
  <code>
 
  <code>
 
  <TaxRequest>
 
  <TaxRequest>
Line 108: Line 110:
 
   <Tax>6.50</Tax>
 
   <Tax>6.50</Tax>
 
   </TaxResponse>
 
   </TaxResponse>
 +
</code>
 +
 +
= Stock Availability =
 +
 +
Lorem ipsum...
 +
 +
* '''RESTful Request'''
 +
 +
<code>http://signals.thewhiteroom.com/cgi-bin/ws/stock</code>
 +
 +
* '''XML Request'''
 +
<code>
 +
<StockRequest>
 +
  <Products>
 +
    <ProductID qty="3" id="FC4242">
 +
      <ProdAttr code="BR"></ProdAttr>
 +
      <ProdAttr code="39"></ProdAttr>
 +
    </ProductID>
 +
  </Products>
 +
</StockRequest>
 +
</code>
 +
 +
* '''XML Response'''
 +
<code>
 +
<?xml version="1.0" encoding="utf-8" ?>
 +
<StockResponse>
 +
  <Products>
 +
    <ProductID qty="0" id="FC4242">
 +
      <ProdAttr code="BR">Unavailable</ProdAttr>
 +
      <ProdAttr code="39">Unavailable</ProdAttr>
 +
    </ProductID>
 +
  </Products>
 +
</StockResponse>
 
  </code>
 
  </code>
  
Line 118: Line 153:
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/checkout</code>
 
  <code>http://signals.thewhiteroom.com/cgi-bin/ws/checkout</code>
  
* '''Expected XML'''
+
* '''XML Request'''
 
  <code>
 
  <code>
 
  <OrderRequest>
 
  <OrderRequest>
Line 163: Line 198:
 
   <ProductIDs>
 
   <ProductIDs>
 
   <ProductID qty="1">HK6614</ProductID>
 
   <ProductID qty="1">HK6614</ProductID>
   <ProductID qty="2">HJ2722</ProductID>
+
   <ProductID qty="4" opt="S-RED">HJ2722</ProductID>
 
   </ProductIDs>
 
   </ProductIDs>
 
  </OrderRequest>
 
  </OrderRequest>

Latest revision as of 14:37, 6 September 2012

Development Server

Requests are RESTful URL calls combined with XML sent as raw Standard Input (non-urlencoded POST Requests). To reach the Web Service, use this URL:

http://signals.thewhiteroom.com/cgi-bin/ws

The URL must be combined with a command such as login, shipping, tax, or checkout. So a full request will look like one of these:

User Login

Allow access to membership database so mobile app can authenticate existing accounts. Calls will be made directly to MySQL database to authenticate user login. Response will be name, address, phone, etc of customer table.

Here is an example of how to make this call:

  • RESTful Request
http://signals.thewhiteroom.com/cgi-bin/ws/login
  • XML Request

<MemberRequest>
  <Email>johnsmith@example.com</Email>
  <Password>12345</Password>
</MemberRequest>

  • XML Response

<?xml version="1.0" encoding="utf-8" ?>
 <MemberResponse>
  <MemberID>5</MemberID>
   <Addresses>
    <Address type="billing">
     <Email>johnsmith@example.com</Email>
     <FirstName>John</FirstName>
     <LastName>Smith</LastName>
     <Street1>72 Cascade Dr</Street1>
     <Street2>Ste 2</Street2>
     <City>Rochester</City>
     <State>NY</State>
     <Zip>14614</Zip>
     <DayPhone>585-232-5670</DayPhone>
     <EveningPhone></EveningPhone>
    </Address>
   </Addresses>
</MemberResponse>

Shipping Info

Allow access to Hazel's shipping cost calculator (a custom Hazel template). Web service will allow for remotely calling Hazel with given products and address information with filtered response of shipping options and costs. This is specific to the customer. Currently, only the products themselves are used in the calculation (not the address).

  • RESTful Request
http://signals.thewhiteroom.com/cgi-bin/ws/shipping
  • XML Request

<ShippingRequest>
   <Zip>80007</Zip>
   <ProductIDs>
     <ProductID qty="1">HK6614</ProductID>
     <ProductID qty="3" opt="S-RED">HJ2722</ProductID>
   </ProductIDs>
</ShippingRequest>

NOTE: Specify options to products with the opt parameter separated by a dash(-). In the example above, two options are being set with the product HJ2722: S - Small, RED - For the color RED.

  • XML Response

<?xml version="1.0" encoding="utf-8" ?>
 <ShippingResponse>
  <ShippingCost>
   <Method type="Standard">11.99</Method>
   <Method type="Rush (Continental US Only)">20.98</Method>
   <Method type="2-Day (Continental US Only)">24.98</Method>
   <Method type="Canada">24.94</Method>
  </ShippingCost>
 </ShippingResponse>

Tax Calculator

Only the state is used to calculate tax (on the store used on the devel site). We may need to expand this in a later revision. Other options can be sent, but only <State> is read from the Tax Request.

  • RESTful Request
http://signals.thewhiteroom.com/cgi-bin/ws/tax
  • XML Request

<TaxRequest>
 <State>OH</State>
 <Zip>45431</Zip>
 <ProductIDs>
  <ProductID qty="1">7326</ProductID>
  <ProductID qty="1">15283</ProductID>
 </ProductIDs>
 <PromotionCode>CODE123</PromotionCode>
</TaxRequest>

  • XML Response

<?xml version="1.0" encoding="utf-8" ?>
 <TaxResponse>
  <Tax>6.50</Tax>
 </TaxResponse>

Stock Availability

Lorem ipsum...

  • RESTful Request
http://signals.thewhiteroom.com/cgi-bin/ws/stock
  • XML Request

<StockRequest>
  <Products>
    <ProductID qty="3" id="FC4242">
      <ProdAttr code="BR"></ProdAttr>
      <ProdAttr code="39"></ProdAttr>
    </ProductID>
  </Products>
</StockRequest>

  • XML Response

<?xml version="1.0" encoding="utf-8" ?>
<StockResponse>
  <Products>
    <ProductID qty="0" id="FC4242">
      <ProdAttr code="BR">Unavailable</ProdAttr>
      <ProdAttr code="39">Unavailable</ProdAttr>
    </ProductID>
  </Products>
</StockResponse>

Checkout

The order will travel the "normal" process once submitted to Hazel in this way. All emails will be sent, and order information added to the database. The only difference will be the custom response (in XML) back mobile client.

  • RESTful Request
http://signals.thewhiteroom.com/cgi-bin/ws/checkout
  • XML Request

<OrderRequest>
 <Addresses>
  <Address type="billing">
   <Email>brandon@scooby.netsville.com</Email>
   <FirstName>James</FirstName>
   <LastName>Camire</LastName>
   <Street1>1111 Washington St</Street1>
   <Street2>Suite 200</Street2>
   <City>Golden</City>
   <State>CO</State>
   <Zip>80401</Zip>
   <DayPhone>720-260-4768</DayPhone>
   <EveningPhone></EveningPhone>
  </Address>
  <Address type="shipping">
   <Email>brandon@scooby.netsville.com</Email>
   <FirstName>Mary</FirstName>
   <LastName>Camire</LastName>
   <Street1>15602 West 79th Pl</Street1>
   <Street2> </Street2>
   <City>Arvada</City>
   <State>CO</State>
   <Zip>80007</Zip>
   <DayPhone>303-123-4567</DayPhone>
   <EveningPhone></EveningPhone>
  </Address>
 </Addresses>
 <Shipping type="Standard">5.22</Shipping>
 <PromotionCode>THX10</PromotionCode>
 <OrderSubtotal>99.37</OrderSubtotal>
 <OrderTax>99.37</OrderTax>
 <OrderDiscount>10.00</OrderDiscount>
 <MemberID>12345</MemberID>
 <CustomerIP>74.100.182.104</CustomerIP>
 <CreditCard>
  <Name>James Camire</Name>
  <Number>5105105105105100</Number>
  <ExpMonth>09</ExpMonth>
  <ExpYear>09</ExpYear>
  <CSC>123</CSC>
 </CreditCard>
 <ProductIDs>
  <ProductID qty="1">HK6614</ProductID>
  <ProductID qty="4" opt="S-RED">HJ2722</ProductID>
 </ProductIDs>
</OrderRequest>

  • XML Response

<?xml version="1.0" encoding="utf-8" ?>
 <OrderReponse>
  <ShippingTotal>9.09</ShippingTotal>
  <TaxTotal>11.82</TaxTotal>
  <ProductTotal>145.00</ProductTotal>
  <DiscountTotal>10.00</DiscountTotal>
  <GrandTotal>155.91</GrandTotal>
  <OrderNumber>1090386</OrderNumber>
  <ClientID>12345</ClientID>
  <MSG>Thank you for your order! You should be receiving an email shortly.</MSG>
 </OrderReponse>

Order Status