Join Free
+ Reply to Thread
Results 1 to 6 of 6
  1. #1

    Common Example API Queries

    Our API is VERY flexible. The following are some example queries that accomplish common use cases that we see. The results returned by these examples are in JSON format. If you are using Google Chrome as your web browser, add an extension like JSONView which formats the response in an easy to read format.

    Simple Product Search

    First we have a simple product search with no filters applied. Mens Running Shoes

    PHP Code:
    http://api.prosperent.com/api/search?query=mens+running+shoes&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 
    This returns a list of relevant products for the specified query. We automatically weight the results not only by relevance, but also by brand and merchant performance. You will always get back results that have a high probability of selling.

    Finding a specific merchant

    Maybe you want results from a specific merchant though. We provide an unchanging merchantId for each of our merchants. This ensures consistency across all of our api endpoints. If a merchant changes their name, or formats it differently, the id will stay the same. You can lookup the merchantId for any of our merchants here: http://prosperent.com/merchants/all

    or by sending a query to our merchant api. In this case I would like to find nordstrom.com, so I use the filterDomain parameter and send a query over to the Merchant api endpoint:

    PHP Code:
    http://api.prosperent.com/api/merchant?filterDomain=nordstrom.com&imageSize=120x60 
    Filtering Products by a specific merchantId

    The above query to the merchant api gave us back the merchantId for nordstrom: 127294

    Let’s use this to perform the same Mens Running Shoes query, but limiting the products to Nordstrom only by using a merchantId filter &filterMerchantId=127294:
    PHP Code:
    http://api.prosperent.com/api/search?query=mens+running+shoes&filterMerchantId=127294&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 

    Filter product results by multiple MerchantId’s

    Now we see that all of our results are restricted to Nordstrom. Maybe we want results from Zappos (123473) as well. We can add that to the query using a pipe | as a separator. &filterMerchantId=127294|123473
    PHP Code:
    http://api.prosperent.com/api/search?query=mens+running+shoes&filterMerchantId=127294|123473&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 
    Change the number of results returned

    That works, but we’re only getting back a few results (10 by default). Let’s use the limit parameter to bump that up to 1000 &limit=1000
    PHP Code:
    http://api.prosperent.com/api/search?query=mens+running+shoes&filterMerchantId=127294|123473&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0&limit=1000 
    Enabling faceted search

    Faceted search is used on most popular ecommerce sites. This feature allows you the ability to display a list of brands, merchants, and categories associated with a search query. It helps your end users drill down to the specific products they want, and gives you a quick way to see all of the data returned by our api. &enableFacets=1 enables all facets, or we can specify the facets we want with a pipe separated list &enableFacets=brand|category|merchant

    PHP Code:
    http://api.prosperent.com/api/search?query=mens+running+shoes&enableFacets=1&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 
    We see several new nodes added to the response including: productId (used for performing price comparisons), category, brand, merchantId, and merchant

    Returning the top 100 brands for a specific merchant

    Now that we know how to use facets, let’s take a look at results for nordstrom and enable just the brand facet so we can get back a list of the top 100 brands along with a count of the number of products for each brand:

    PHP Code:
    http://api.prosperent.com/api/search?filterMerchantId=127294&enableFacets=brand&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 

    Filtering products by category

    Filters allow us to widdle down results to something very specific. In this example we will pull back womens sandals. All of our products across our merchants have normalized categories, so we can apply some advanced filtering based on category: shoes > women > sandals

    PHP Code:
    http://api.prosperent.com/api/search?filterCategory=shoes%20%3E%20women%20%3E%20sandals&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 
    Now we get back exactly what we were looking for. You can apply the same merchantId filters as before, or even specify a search query along with the filter.

    Multiple filters (Category and Brand)

    You can of course string multiple filters together. In this example we are looking for womens sandals that are from the brand Nike:

    PHP Code:
    http://api.prosperent.com/api/search?filterCategory=shoes%20%3E%20women%20%3E%20sandals&filterBrand=nike&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 
    Query for a UPC
    Some of our merchants provide UPC level data in our api. You can find a product by UPC by simply including the UPC code in the query:

    PHP Code:
    http://api.prosperent.com/api/search?query=888701116066&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0 

    Query for TwoTap supported products
    TwoTap allows you to offer a shopping cart and control the checkout process for visitors that come to your site. We offer the product data, and they handle the checkout process. Both our merchant and product api endpoints support a flag to filter ONLY the merchants that support TwoTap.
    PHP Code:
    &filterTwoTapSupported=
    Further, when enabled, the product api returns a special set of fields that you can pass off to the TwoTap api:
    PHP Code:
    twoTapProductUrl 
    and
    PHP Code:
    twoTapAffiliateLink 
    . Here is an example product search query:

    PHP Code:
    http://api.prosperent.com/api/search?query=running%20shoes&api_key=2faab4bcbd4ed51fd1706a7ee940bfe0&filterTwoTapSupported=1 

  2. #2
    These are really useful.

    But when i do price comparison using productId i always get a single product. So i have to frame another query using few words in keyword(title) to get related products for comparison.

  3. #3
    In order for the productId to show a comparison, the products need to have the same upc or an identical title. We are working on some other methods as well. I typically do comparisons like you and just use the keyword and show a couple results.

  4. #4
    But When the keyword is too lengthy, some times i don't get results. So i always send first 3 words and last 3 words of the keyword. So i get some results.

  5. #5
    Quote Originally Posted by affi View Post
    But When the keyword is too lengthy, sometimes i don't get results. So i always send first 3 words and last 3 words of the keyword. So i get some results.
    If Prosperent is unable to find 2 or more similar products, then your query per productId will always return 1 item. Those that are available at multiple merchants, do then show the merchants in the facets etc. if you use groupBy=productId

    As for your observation, the more specific a query the less results are returned. This is where the relevancy threshold becomes important. If your relevancy threshold is set to 1, you won't get any results back if your keyword is lengthy, so setting it to 0.7, for example, will give you results whereas 1 won't as it tries to match the exact phrase.

    Also remember you could use wildcards in your query instead of having to search 3+3 at a time or however else you'd like to handle the request.

  6. #6
    Yes i will check with the relevancy threshold also for price comparison purpose and also wild cards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
coupons | coupons and deals