API Guide - Stylitics/guide GitHub Wiki
Intro
The Stylitics API supports http or https requests, and is CORS enabled. Outfit results are cached, and the cache is refreshed half-hourly. When editing outfits on the Stylitics outfitting platform, be aware that the changes will take up to an hour to be reflected in the API results. Only published outfits will appear in API results.
Endpoints
URL root
widget-api.stylitics.com
GET /api/outfits
Params
username
- The username given to you by Stylitics. This will scope the request to any accounts you have with Stylitics (for example, if you have more than one, like
yourcompany-men
andyourcompany-women
you will just passyourcompany
total
- The max number of outfit results to return. You should set this even if making a request for a gallery-type implementation -- it can be arbitrarily high if you definitely want all published outfits matching your other request params
item_number
- Only return outfits containing the item identified in Stylitics by the parameter value. In the Stylitics outfitting platform, this field is called
remote_id
. It typically represent a colorway-level identifier for your product. Supports multiple values by passing a comma-separated list of identifiers
tags
- A comma separated list of tags. The outfit results will contain outfits matching any of the provided tags
all_tags
- A comma separated list of tags. The outfit results will contain outfits matching all of the provided tags. If both
tags
andall_tags
are provided, the logic oftags
is applied first, thenall_tags
. If the two sets of tags are disjoint, no results will be returned.
callback
- If present, the API request will be considered a JSONP request and the response will be returned wrapped as a function call to the function provided as the value of this param.
gender
- Outfits returned will only be those containing items matching the specified gender. Eligible values are
male
andfemale
, case sensitive. Not required for almost all use cases (one scenario would be if you have tags that are used for both mens' and womens' outfits, but generally your account & tagging plan will be set up to avoid this)
region
- Not applicable for most clients. This scopes the results to items from a specific region. If you haven't discussed functionality around this with Stylitics, assume this field is not set for your items.
Other params listed in the API Explorer are either used only by Stylitics' drop-in widget, or are deprecated.
Response data
- Outfits
- id - integer - the Stylitics outfit ID
- tags - array of strings - any tags associated with this outfit
- account_username - string - the Stylitics outfitting platform account the outfit belongs to (for example, if your client username is
yourcompany
and you use multiple accounts, this might be something likeyourcompany-women
- image_url - string - default collage image url for the outfit. It is the same as
lookbook_image_url
, 450x450 - large_image_url - string - large collage image url. Prefer this for mobile.
- lookbook_image_url - string - 450x450 version of the collage image
- items - array of items - see Items section below
- Items
- item_id - integer - Stylitics internal ID for this item
- remote_id - string - the clients' identifier for this product (typically colorway-level). Equivalent to the
item_number
value that would be passed as a request param for this item. - name - string - name of the item
- price - decimal - price of the item, if available
- sale_price - sale price, if available and logic around this has been set up with Stylitics (not default)
- retailer - string - retailer of the item
- affiliate_link - purchase link for the item (the name of this field is a legacy artifact; is not typically actually an affiliate link. It is whatever the client provided to Stylitics as the purchase url for the item)
- brand - string - brand of the item
- style - string - Stylitics' most-specific categorization of the item
- retailer_style - string - if provided in a feed, the retailer's most-specific categorization of the item
- region - string - region the item belongs to. Null unless you've discussed/setup regional distinctions with Stylitics
- image_url - string - default image url for the item (same as
small_image_url
below). - small_image_url - string - small image url for the item
- large_image_url - string - larger image url for the item - prefer this for mobile or outfit detail page implementations
- account_username - string - same as this field in Outfit, above
GET /api/outfits/:id
Get a single outfit by its Stylitics ID
GET /api/items/replacements
Get a set of suggested replacement items for a given item or comma separated list of items
Request
- ids - a single Stylitics item ID or comma separated list of item IDs
The response will be keyed by the item ids provided to indicate which items are intended as replacements for which specified ids