Create a Shopping List

This endpoint allows you create a new shopping list.

Create Shopping List

POST https://api.whisk.com/list/v2

You can use a body parameter to create a shopping list:

Headers

NameTypeDescription

Authentication

string

Server Token or a User Access token containing shopping_list:write scope to authorize the API usage. For more information, see Authentication. Note: While using a Server Token for authentication, the new shopping list is not linked to any user and can only be accessed using its identifier (id).

Request Body

NameTypeDescription

body

object

The body object contains your shopping list definition. See the Body Object Example below.

{
  "list": {
    "id": "string",
    "name": "string",
    "primary": true
  },
  "content": {
    "items": [
      {
        "id": "string",
        "item": {
          "name": "string",
          "brand": "string",
          "comment": "string",
          "quantity": 0,
          "unit": "string"
        },
        "checked": true,
        "image_url": "string",
        "analysis": {
          "product": {
            "canonical_name": "string",
            "original_name": "string"
          },
          "category": {
            "canonical_name": "string"
          },
          "brand": {
            "canonical_name": "string"
          }
        },
        "recipe": {
          "recipe_id": "string",
          "position": 0
        },
        "combined": {
          "combined_item_id": "string",
          "quantity": 0
        },
        "created_time": "string",
        "updated_at": "string",
        "matching_properties": {
          "gtin": "string",
          "custom_product_id": "string"
        }
      }
    ],
    "combined_items": [
      {
        "id": "string",
        "item": {
          "name": "string",
          "brand": "string",
          "comment": "string",
          "quantity": 0,
          "unit": "string"
        },
        "checked": true,
        "image_url": "string",
        "analysis": {
          "product": {
            "canonical_name": "string",
            "original_name": "string"
          },
          "category": {
            "canonical_name": "string"
          },
          "brand": {
            "canonical_name": "string"
          }
        },
        "created_time": "string",
        "updated_at": "string"
      }
    ],
    "recipes": [
      {
        "id": "string",
        "name": "string",
        "images": [
          {
            "responsive": {
              "url": "string",
              "width": 0,
              "height": 0,
              "selection": {
                "x": 0,
                "y": 0,
                "width": 0,
                "height": 0
              }
            },
            "url": "string"
          }
        ],
        "source": {
          "name": "string",
          "display_name": "string",
          "source_recipe_url": "string",
          "image": {
            "responsive": {
              "url": "string",
              "width": 0,
              "height": 0,
              "selection": {
                "x": 0,
                "y": 0,
                "width": 0,
                "height": 0
              }
            },
            "url": "string"
          },
          "license": "LICENCE_INVALID"
        }
      }
    ]
  }
}

Request Body Object Example

{
   "name":"My New Shopping List",
   "primary":true,
   "items":[
      {
         "normalized":{
            "name":"bacon",
            "brand":"Oscar mayer",
            "comment":"cooked, crumbled",
            "quantity":8,
            "unit":"slices"
         },
         "gtin":"00000034411207"
      },
      {
         "raw":{
            "text":"2 garlic cloves"
         },
         "custom_product_id":"6037bd956f0187c6c0f56241"
      }
   ],
   "recipes":[
      {
         "recipe_id":"1011f5a116db3c3e56e57bea0a52ffbfca5fc96f6b1",
         "scale":{
            "scale":2
         },
         "ingredients":{
            "ids":[
               "f83e58370ebc70b01798c575f5132a76d8dba890:1:0"
            ]
         }
      },
      {
         "recipe_id":"10745889d4a1c0f4b8dbfab66bffa433524"
      }
   ],
   "language":"en"
}

The body object contains the following core attributes that let you define your shopping list:

Attribute

Type

Description

Example

name

string

The shopping list name.

"name":"My New Shopping List"

primary

boolean

This attribute allows you to set the shopping list as your default list. You can skip this attribute or set it to False when you don't to want to make it your primary list.

"primary":true

language

string

This attribute allows you to set the shopping list language as per ISO 639 standards.

The language you set plays a vital role in analyzing the items you add to your list, and it must match the language of the items you plan to add to the list, or you must add the items in English. Any mismatch could result in problems with identifying the related image, category, and store item. For example, if you set the shopping list language as German and use the French language to add items, the items' analysis would fail. On the contrary, if you add items in German or English language, the corresponding data will be easily matched and found.

You can also skip this attribute if you want to use the language set in your User Preferences, and if you don't have any language set there, it gets set to English by default.

"language":"en"

The body object also contains items and recipes arrays that allow you to add items to the shopping list.

items

The items array allows you to add individual items in a normalized or raw format based on your preference.

Attribute

Type

Description

Example

normalized

object

This object allows you to add items in a normalized format by specifying each information element of the item separately.

Optionally, you can also link an item to a custom product using gtin or custom_product_id if needed.

{

"normalized":{

"name":"bacon",

"brand":"Oscar mayer",

"comment":"cooked, crumbled",

"quantity":8,

"unit":"slices"

},

"gtin":"00000034411207"

}

raw

object

This object allows you to add the item details like a raw string and leave it for automatic normalization. Optionally, you can also link an item to a custom product using gtin or custom_product_id if needed.

{

"raw":{

"text":"2 garlic cloves"

},

"custom_product_id":"6037bd956f0187c6c0f56241"

}

recipes

The recipes array allows add a list of recipes to move their ingredients as items in your shopping list. You can either specify the exact ingredients of a particular recipe or move all recipe ingredients to the shopping list, depending on the need.

Attribute

Type

Description

Example

recipe_id

string

This attribute allows you to identify the recipe for moving its ingredients as items to your shopping list.

recipe_id": "1011f5a116db3c3e56e57bea0a52ffbfca5fc96f6b1"

scale

object

This object allows you to mention the scale to determine and set the ingredient's quantity while adding it to the shopping list. For example, if you set it to 2, the ingredient/item's count or volume gets doubled in the shopping list. If you want to add the exact quantity specified in the recipe, you can skip it or set it to 1.

"scale":

{

"scale":2

}

ingredients

object

This array allows you individually specify each recipe ingredient that you want to add as an item to the shopping list. If you are looking to move all recipe ingredients to your shopping list, you can skip it.

"ingredients":{

"ids":[

"f83e58370ebc70b01798c575f5132a76d8dba890:1:0"

]

}

}

Sample Request and Response

curl -X POST "https://api.whisk.com/list/v2"
    -H "Accept: application/json"
    -H "Authorization: Bearer <YOUR-API-ACCESS-KEY>"
    -d "{ \"name\":\"My New Shopping List\", \"primary\":true, \"items\":[ { \"normalized\":{ \"name\":\"bacon\", \"brand\":\"Oscar mayer\", \"comment\":\"cooked, crumbled\", \"quantity\":8, \"unit\":\"slices\" }, \"gtin\":\"00000034411207\" }, { \"raw\":{ \"text\":\"2 garlic cloves\" }, \"custom_product_id\":\"6037bd956f0187c6c0f56241\" } ], \"recipes\":[ { \"recipe_id\":\"1011f5a116db3c3e56e57bea0a52ffbfca5fc96f6b1\", \"scale\":{ \"scale\":2 }, \"ingredients\":{ \"ids\":[ \"f83e58370ebc70b01798c575f5132a76d8dba890:1:0\" ] } }, { \"recipe_id\":\"10745889d4a1c0f4b8dbfab66bffa433524\" } ], \"language\":\"en\"}"

Whisk allows you to discover and understand its API capabilities on the Swagger interface with the ability to try out the API calls directly in your browser. You can call this endpoint here.

Last updated