Basic Product CRUD APIĀ 

Updates have been made to include organization ID in the URL path as of April 2017. This is the preferred method, but previously-working methods will continue to function as expected.

Overview

The product CRUD API is a REST API supporting the following actions and endpoints:

  • CREATE a product - POST https://app.salsify.com/api/v1/orgs/<org_ID>/products
  • UPDATE a product - PUT https://app.salsify.com/api/v1/orgs/<org_ID>/products/<product_id>
  • READ a product - GET https://app.salsify.com/api/v1/orgs/<org_ID>/products/<product_id>
  • DELETE a product - DELETE https://app.salsify.com/api/v1/orgs/<org_ID>/products/<product_id>

<product_id> should be replaced with the unique Salsify identifier for each product. 

<org_id> should be replaced by the organization ID which is unique to each Salsify app instance. The org ID can be found after /orgs/ in the URL path for your Salsify organization, eg. in https://app.salsify.com/app/orgs/9-99999-9999-9999-9999-999999999/products the org ID is 9-99999-9999-9999-9999-999999999.

Authorization

Authorization should be done using the HTTP Authorization header, or by passing the authentication token via an access_token query parameter.  See: API Authentication for more information.

Input Format

The serialization format for products will mirror the format used for JSON imports. The doc for that can be found at:  JSON Import Format but at a high level products are represented as key value pairs:

{
  "SKU": "3635065",
  "Model": "KDL-40NX700",
  "Name": "Sony 40 in. Bravia TV",
  "Description": "This is an amazing tv. You should buy it.",
  "Brand": "Sony",
  "Aspect Ratio": "16:9",
  "Feature": ["Child Lock", "Picture in Picture", "Sleep Timer"],
  "Release Date": "10-19-2013",
  "Inventory": "10"
}

Usage

When creating a product you must specify the product id (which will vary based on how you've configured your schema in Salsify). The id cannot start with an '=', '_', or 'salsify'. For updates, Salsify will only modify the properties mentioned in the API request. For example, PUTing the following JSON will only update a products inventory level and leave other properties untouched: 

{
   "Inventory": "10"
}

You can change a product's id via a PUT using the old id in the URL e.g. PUT https://app.salsify.com/api/v1/orgs/<org_ID>/products/3635065

{
 "SKU": "3635065-UPDATED"
}

will update the product's id from 3635065 to 3635065-UPDATED . Property assignments can be deleted from products by setting them to null or an empty array e.g.

{
 "Inventory": null
}

The create and update endpoints will not yet support creating digital assets, relations, or product bundles. Those are on the roadmap.

Ruby Example

Here's a Ruby example of API usage. It leverages the rest-client gem.  Note that the referenced items (e.g. SKU, Name, Brand) need to be existing attributes exactly in that form in the existing schema, and they are case sensitive.

require 'rest_client'

# Create the product
product = {'SKU' => '12345', 'Name' => 'Big TV', 'Brand' => 'Salsify'}
RestClient.post('https://app.salsify.com/api/v1/orgs/9999-9999-9999-9999/products/', product.to_json,
                accept: 'application/json', content_type: 'application/json',
                Authorization: "Bearer <your auth token here>")

# Update the product
product = {'Inventory' => '10'}
RestClient.put('https://app.salsify.com/api/v1/orgs/9999-9999-9999-9999/products/12345', product.to_json,
               accept: 'application/json', content_type: 'application/json',
               Authorization: "Bearer <your auth token here>")

# Get the product
result = RestClient.get('https://app.salsify.com/api/v1/orgs/9999-9999-9999-9999/products/12345', accept: 'application/json',
                        Authorization: "Bearer <your auth token here>")
product = JSON.parse(result)

# Delete the product
RestClient.delete('https://app.salsify.com/api/v1/orgs/9999-9999-9999-9999/products/12345', accept: 'application/json',
                  Authorization: "Bearer <your auth token here>")