0 Replies Latest reply on May 28, 2007 1:23 AM by tzikin

    [Web Services] REST arguments

    tzikin
      Hi,

      I would like to make a checkout using the amazon's web services. However, I don't know how to pass the arguments about the products. When I make a search for something, I use the web service like this (I use Cairngorm, this is the content of the delegate function):

      var service:HTTPService = ServiceLocator.getInstance().getHTTPService("amazonService");

      var params:Object = {};
      params.Service = "AWSECommerceService";
      params.AWSAccessKeyId = AmazonConstants.AMAZON_API_KEY;
      params.Operation = "ItemSearch";
      params.Keywords = p_keywords;
      params.ResponseGroup = "Images,ItemAttributes,Offers";
      params.SearchIndex = s_index;
      params.ItemPage = item_page;
      var token:AsyncToken = service.send(params);
      var responder:mx.rpc.Responder = new mx.rpc.Responder(searchAmazon_onResult, searchAmazon_onFault);
      token.addResponder(responder);

      Here, I don't have any problem. In the request, arguments are something like this:

      <Argument Name="SearchIndex" Value="Blended"/>
      <Argument Name="Service" Value="AWSECommerceService"/>
      <Argument Name="Keywords" Value="reina"/>
      <Argument Name="SubscriptionId" Value="XXXXXXXXXXXXXXXXX"/>
      <Argument Name="ResponseGroup" Value="ItemAttributes,Large,Small"/>
      <Argument Name="Operation" Value="ItemSearch"/>

      But to make a checkout, I need to have something like this:

      <Argument Name="Item.1.ASIN" Value="B000IB0C9A"/>
      <Argument Name="Item.1.Quantity" Value="1"/>
      <Argument Name="Service" Value="AWSECommerceService"/>
      <Argument Name="SubscriptionId" Value="XXXXXXXXXXXXXXXXX"/>
      <Argument Name="Item.2.ASIN" Value="B000IONL90"/>
      <Argument Name="Item.2.Quantity" Value="1"/>
      <Argument Name="ResponseGroup" Value="Cart,CartSimilarities"/>
      <Argument Name="Item.3.ASIN" Value="B00004CT5E"/>
      <Argument Name="Item.3.Quantity" Value="5"/>
      <Argument Name="Operation" Value="CartCreate"/>

      The problem is I don't know how to create dynamic arguments in my object "params":

      Item.1.ASIN, Item.1.Quantity, Item.2.ASIN, Item.2.Quantity, Item.3.ASIN, Item.3.Quantity

      any ideas?

      Thank you!