&Follow SJoin OnSugar
Already a member?   Sign In
API Overview

L'API ShopStyle permet aux applications client d’accéder aux données de tous les éléments des sites Web ShopStyle, dont les produits, les marques, les sites marchands, les catégories et les looks. Pour un développement plus facile, l'API est un service web REST-style, composé simplement de requêtes HTTP GET. Les données sont remises en format XML ou JSON. L'API est un langage indépendant et simple d’utilisation à partir de PHP, Java, JavaScript, ou tout autre moteur de développement.

Pour utiliser l'API ShopStyle, vous devez d'abord vous inscrire ici afin d’obtenir votre clé API. Une fois que vous avez cette clé, vous pouvez commencer à utiliser les actions API décrites ci-dessous.

Pour utiliser l'API ShopStyle, Assurez-vous que votre identifiant soit annexé à toutes les requêtes.

Audience Ciblée

Ce document est destiné aux programmeurs qui voudraient développer une application client utilisant l'API ShopStyle. Il est nécessaire de savoir comment invoquer une requête HTTP avec un URL particulier et de traiter le texte de la réponse en XML ou JSON.

Comment utiliser l’API

Voici les étapes pour utiliser l'API, indépendamment du langage informatique que vous utilisez :

  1. Choisissez le mode qui répond aux besoins de votre application. Par exemple, le mode apiSearch est utilisé pour obtenir les produits qui correspondent à une catégorie donnée ou à une marque.
  2. Construisez un URL pour ce mode avec l'hôte approprié, le nom du mode et les paramètres nécessaires.
  3. Invoquez l'URL comme un HTTP GET.
  4. Quand la réponse HTTP arrive, extraire les éléments de données du corps de la réponse.

Le reste de ce document décrit les détails pour créer l'URL de chacun des modes de l'API. Le format XML peut être vu des réponses en cliquant sur les URLs types montrées pour chaque mode. Les réponses en format JSON contiennent des informations identiques, mais dans un langage différent.

There is also a sample client application written in PHP.

ShopStyle API URLs

All ShopStyle API URLs have the following form:

http://api.shopstyle.com/action/METHOD_NAME?pid=YOUR_API_KEY&format=FORMAT&site=SITE&...

The METHOD_NAME is taken from the list of methods in the API shown at left.

Common API Parameters

All methods in the API accept these parameters:

pid Unique API_KEY string that is assigned to the caller. Sign up here to get your Shopstyle API key. Your Partner ID: This parameter must be present.

format

The format of the response. Supported values are:

  • xml - The response is in XML format with UTF-8 encoding. This is the default if the parameter is absent.
  • json - The response is in JSON format with UTF-8 encoding.
  • json2 - Same as json, but numbers and booleans are returned as JSON numbers and booleans instead of strings.
  • jsonvar - The response is in JSON format with UTF-8 encoding and includes a JavaScript assignment statement. This is useful when the API URL is the src attribute of a script tag, as the result is stored in a variable that can be used by subsequent JavaScript code.
  • jsonvar2 - Same as jsonvar, but numbers and booleans are returned as JSON numbers and booleans instead of strings.
  • jsonp - The response is in JSON format with UTF-8 encoding wrapped in a JavaScript method called padding. The padding must be specified with the query parameter 'callback'. Only single expressions (function reference, or object property function reference) are accepted as valid paddings.
  • rss - The response is an RSS feed (beta).
site Specifies the ShopStyle website to be searched or queried (optional; defaults to US fashion).

Product Query Parameters

Many of the methods listed in the next section accept this set of optional product query parameters, which are similar to query parameters used by the ShopStyle websites:

fts Text search terms, as a user would enter in a Search: field.
cat A product category. Only products within the category will be returned. The easiest way to find values for this parameter is to browse to a category on the ShopStyle website and take the last element of the URL path, e.g., from http://www.shopstyle.com/browse/dresses, use "dresses." Another way is to look at the categories of the products returned by the apiSearch or to look at the list of categories from apiGetCategoryHistogram.
fl

Specify one or more filters on the query for brand, retailer, price, discount, and/or size. Each filter value has an initial letter and a numeric id. The easiest way to construct a filter list is to do a search on ShopStyle, select one or more filters in the UI, and copy the resulting URL. To convert brand or retailer names to ids, use the apiGetBrands and apiGetRetailers calls. Here is a sample URL showing sale clothing from two brands and one retailer:

http://www.shopstyle.com/browse/womens-clothes?fl=d0&fl=b3510&fl=b689&fl=r21

Filter prefixes are:

  • b - brand
  • r - retailer
  • p - price
  • d - sale
  • s - size
  • c - color
pdd A "price drop date" expressed as a number of milliseconds since Jan 1, 1970. If present, limits the results to products whose price has dropped since the given date.
prodid The id of a specific product to return. This may be specified multiple times to get many products in one response.


Post A Comment

To post comments, please log in or register.