deleted deleted

deleted deleted   •   almost 10 years ago

Price range? Other undocumented API features?

In your most recent contest E-mail, copied below, you should a query that had a price range. I don't see priceRangeId in either the Product or Search API. Where is this field documented, especially how to use it to express a range? Along those lines, I'm wondering if there are a lot of other advanced search capabilities that aren't documented, or that I can't find?

http://developer.shop.com/documentation/SearchService
http://developer.shop.com/documentation/ProductService

--- E-mail ----

The SHOP.COM API gives you access to millions of products, but also gives you the power to target very specific products. Suppose you wanted a vertical app about shoes, and its niche is users only interested in the most expensive, casual Vans. In the following, you can see how our API is used to retrieve shoes that are:

categoryId=2-2179248 | Casual Shoes!
brandId=Vans | Vans!
priceRangeId=[65.01 TO 247.34] | upper priced (the expensive ones)!

CURL

curl --request GET \
--url 'https://api.shop.com/AffiliatePublisherNetwork/v1/products?publisherID=TEST&locale=en_US&perPage=15&priceRangeId=%5B65.01%20TO%20247.34%5D&brandId=Vans&categoryId=2-2179248' \
--header 'apikey: XXXX' \
--header 'cache-control: no-cache' \
--header 'content-type: application/json' \

HTTP

GET /AffiliatePublisherNetwork/v1/products?publisherID=TEST&locale=en_US&perPage=15&priceRangeId=[65.01 TO 247.34]&brandId=Vans&categoryId=2-2179248 HTTP/1.1
Host: api.shop.com
Content-Type: application/json
apikey: XXXX
Cache-Control: no-cache

Thanks,
Robert

  • 5 comments

  • Manager   •   almost 10 years ago

    Hi Robert, thanks for the question.

    The list of attributes, including the priceRangeID, can be found here:
    http://developer.shop.com/documentation/apnResources/products

    When a call is made to the PRODUCT endpoint without specifying a specific resource, the results response will include a list of the available categoryIDs, brandIDs, sellerIDs and priceRangeIDs that can be used to further refine the response:

    For example, this call:

    GET /AffiliatePublisherNetwork/v1/products?publisherID=TEST&locale=en_US&perPage=15&start&term=shoes&sellerId&brandId=Vans&categoryId=2-2179248 HTTP/1.1
    Host: api.shop.com
    Content-Type: application/json
    apikey: XXXX
    Cache-Control: no-cache

    Will have the following lists of IDs that could further refine the product group returned. (Notice the array for "brands" is empty because the product group is already filtered by the one Vans brandID.

    "categories": [
    {
    "name": "Athletics",
    "productCount": 74,
    "id": "3-7725_a:7370146"
    },
    {
    "name": "Skateboarding",
    "productCount": 21,
    "id": "3-7725_a:2179272"
    },
    {
    "name": "Sneakers",
    "productCount": 2,
    "id": "3-7725_a:7370148"
    }
    ],
    "brands": [],
    "sellers": [
    {
    "name": "Tags Weekly",
    "productCount": 739,
    "id": "105090"
    },
    {
    "name": "Shoe Metro",
    "productCount": 78,
    "id": "102510"
    },
    {
    "name": "DNA Footwear",
    "productCount": 10,
    "id": "105638"
    }
    ],
    "priceRanges": [
    {
    "minPrice": 5.01,
    "maxPrice": 40,
    "productCount": 104,
    "id": "[5.01 TO 40.00]"
    },
    {
    "minPrice": 40.01,
    "maxPrice": 45,
    "productCount": 85,
    "id": "[40.01 TO 45.00]"
    },
    {
    "minPrice": 45.01,
    "maxPrice": 50,
    "productCount": 111,
    "id": "[45.01 TO 50.00]"
    },
    {
    "minPrice": 50.01,
    "maxPrice": 65,
    "productCount": 72,
    "id": "[50.01 TO 65.00]"
    },
    {
    "minPrice": 65.01,
    "maxPrice": 155,
    "productCount": 50,
    "id": "[65.01 TO 155.00]"
    }
    ]

  • Manager   •   almost 10 years ago

    The priceRangeID does behave in an interesting way. Rather than generating another value for the ID, we opted to make the range and the ID be the same. As you can see each priceRangeID has its corresponding values of minPrice, maxPrice and productCount. The idea was simplicity. Hopefully we did not sacrifice intuitiveness.

    There are no other "unique" treatments of IDs or values in their objects. For each response with multiple products, the list of IDs for categories, brands, sellers, and price ranges available in that group are listed at the end of the response.

  • Manager   •   almost 10 years ago

    Hi Robert,

    The API allows you to construct any price range you wish.

    This call will get all products priced from $5.00 to $31.95, which at this moment is a product count of 2,438,508:

    https://api.shop.com/AffiliatePublisherNetwork/v1/products?publisherID=TEST&locale=en_US&perPage=15&priceRangeId=[5.00 TO 31.95]

    This call will get all products priced from $5.00 to $999.00, which at this moment is a product count of 4,930,486:

    https://api.shop.com/AffiliatePublisherNetwork/v1/products?publisherID=TEST&locale=en_US&perPage=15&priceRangeId=[5.00 TO 999.00]

    When a call is made that returns a collection of products, the system will try to make 5 price range groups that evenly distribute the product counts, and it will provide those price ranges at the end of the return payload. This is just for the developers convenience.

    However, the API allows you to create the price range you desire and use that in the priceRangeId field.

    To directly answer your questions:
    - A search with only a minimum price but no maximum?
    Minimum of $5, with a superfluous Maximum
    priceRangeId=[5.00 TO 9999999.00]

    - A search with only a maximum price no minimum?
    $0 for the minimum, with $25 for the maximum
    priceRangeId=[0.00 TO 25.00]

    Please let me know if this does not address your question.

    Thanks!

  • Manager   •   almost 10 years ago

    Hi Robert,

    Yes, the - sign can be used with the following attributes of the API:
    term
    brandId
    sellerId
    priceRangeID

    Thanks

  • Manager   •   almost 10 years ago

    Tip: When using the price range filter, remember to include the decimal values.

    Example valid format: priceRangeId=[0.00 TO 25.00]

    Leaving out the decimal values can produce unexpected results.

    Example invalid format: priceRangeId=[0 TO 25]

    Thanks

Comments are closed.