<img height="1" width="1" style="display:none" src="https://q.quora.com/_/ad/ad9bc6b5b2de42fb9d7cd993ebb80066/pixel?tag=ViewContent&amp;noscript=1">

Category listing

You can implement category navigation using Loop54. This is a fast and easy way to retrieve products and can also be extended with features such as faceting, custom sorting, personal or aggregated popularity sorting and more. 

Code examples
SHOW INSTRUCTIONS FOR: PHP JSON JAVA .NET
Below is an example of a request - response cycle of an category listing request request.
$request = new Loop54_Request("ProductsInCategory");
$request->setValue("RequestEntity",new Loop54_Entity("Category",$_GET{"category"}));
$request->setValue("ProductsInCategory_FromIndex", 0);
$request->setValue("ProductsInCategory_ToIndex", 9);
$response = Loop54_RequestHandling::getResponse("http://helloworld.54proxy.com", $request);
if ($response->success)
{
    if($response->hasData("ProductsInCategory"))
    {
        $results = $response->getCollection("ProductsInCategory");
        if(count($results)==0)
            echo "There were no items in this category.";

        foreach($results as $resultItem)
        {
            $productId = $resultItem->key->externalId;
            $productTitle = $resultItem->key->getStringAttribute("Title");
            echo $productId . " " . $productTitle; //render a product on the category listing page
        }
    } 
}
else
{
    echo $response->requestId; //log this
}
Below is an example of a request - response cycle of an category listing request request.
POST to  http://helloworld.54proxy.com/productsincategory
{
    "UserId" : "helloworlduser",
    "IP" : "127.0.0.1",

    "RequestEntity":{
        "EntityType":"Category",
        "ExternalId":"Fruit"
    },

    "ProductsInCategory_FromIndex" : 0,
    "ProductsInCategory_ToIndex" : 9,
}

Response: 200 OK
{
  "Success": true,
  "HeroId": "The Count with not enough Writing Sisters",
  "Data": {
    "ProductsInCategory": [
      {
        "Key": {
          "ExternalId": "1",
          "EntityType": "Product",
          "Attributes": {
            "Manufacturer": [
              "The banana company"
            ],
            "Category": [
              "Fruit"
            ],
            "Title": [
              "Banana"
            ],
            "SubCategory": [
              "Musaceae"
            ]
          }
        },
        "Value": 1
      },
      {
        "Key": {
          "ExternalId": "7",
          "EntityType": "Product",
          "Attributes": {
            "Manufacturer": [
              "The banana company"
            ],
            "Category": [
              "Fruit"
            ],
            "Title": [
              "Organic Apple"
            ],
            "SubCategory": [
              "Rosaceae"
            ]
          }
        },
        "Value": 0
      },
      {
        "Key": {
          "ExternalId": "3",
          "EntityType": "Product",
          "Attributes": {
            "Manufacturer": [
              "Fruits n Veggies"
            ],
            "Category": [
              "Fruit"
            ],
            "Title": [
              "Apple"
            ],
            "SubCategory": [
              "Rosaceae"
            ]
          }
        },
        "Value": 0
      },
      {
        "Key": {
          "ExternalId": "17",
          "EntityType": "Product",
          "Attributes": {
            "Manufacturer": [
              "Fruits n Veggies"
            ],
            "Category": [
              "Fruit"
            ],
            "Title": [
              "Orange"
            ],
            "SubCategory": [
              "Citrus"
            ]
          }
        },
        "Value": 0
      }
    ]
  }
}
Below is an example of a request - response cycle of an category listing request request.
The API V2X-based Java Connector is no longer supported. 
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/Java-Connector
Below is an example of a request - response cycle of an category listing request request.
The API V2X-based .NET Connector is no longer supported.
You can view code examples for the V3-based Connector at
https://github.com/LoopFiftyFour/.NET-Connector

Parameters

  • RequestEntity: The category for which to fetch products. In "EntityType" + "ExternalId" format.
  • Paging: The results can be separated into pages using FromIndex and ToIndex (inclusive). Asking for ProductsInCategory_FromIndex : 0 and ProductsInCategory_ToIndex : 9 will yield 10 results. 
  • Descriptives: IP and UserId (If you are using a library, the library should take care of this).