Skip to content

Product_List

Craig edited this page Oct 26, 2012 · 2 revisions

You must specify your API username and password using the Twocheckout.apiusername & Twocheckout.apipassword class variables before calling this method.

##Methods

###list

Use to retrieve a list of all products or only those matching a variety of product attributes.

####Arguments

  • hash Parameters
  • Hash containing list_products parameters. Parameters -> API List Products

####Returns

Returns a ProductList object.

####Example Usage:

HashMap<String, String> params = new HashMap<String, String>();
params.put("pagesize", "3");

ProductList result = TwocheckoutProduct.list(params);

####Example Response (toJson):

{
   "page_info" : {
      "cur_page" : "1",
      "first_entry" : 1,
      "first_page" : 1,
      "first_page_url" : "https://www.2checkout.com/api/products/list_products?cur_page=1",
      "last_entry" : "2",
      "last_page" : 1,
      "last_page_url" : "https://www.2checkout.com/api/products/list_products?cur_page=1",
      "next_page" : null,
      "pagesize" : "20",
      "previous_page" : null,
      "total_entries" : "2"
   },
   "products" : [
      {
         "approved_url" : null,
         "assigned_product_id" : "2",
         "categories" : [],
         "commission" : null,
         "commission_type" : null,
         "description" : "",
         "duration" : "Forever",
         "handling" : "0.00",
         "images" : [],
         "long_description" : "",
         "name" : "Example Product",
         "options" : [],
         "pending_url" : null,
         "price" : "0.01",
         "product_id" : "4774387610",
         "recurrence" : "1 Week",
         "startup_fee" : null,
         "tangible" : "0",
         "vendor_id" : "1817037",
         "vendor_product_id" : "",
         "weight" : "0.00"
      },
      {
         "approved_url" : null,
         "assigned_product_id" : "19",
         "categories" : [],
         "commission" : null,
         "commission_type" : null,
         "description" : null,
         "duration" : null,
         "handling" : "0.00",
         "images" : [],
         "long_description" : null,
         "name" : "Example Product",
         "options" : [],
         "pending_url" : null,
         "price" : "1.00",
         "product_id" : "4774467881",
         "recurrence" : null,
         "startup_fee" : null,
         "tangible" : "N",
         "vendor_id" : "1817037",
         "vendor_product_id" : "",
         "weight" : null
      }
   ],
   "response_code" : "OK",
   "response_message" : "Product list successfully retrieved."
}

Clone this wiki locally