Quickstart

This section shows a simple example of a user searching for recipes, resolving in-stock products for those recipes, and  substituting a product for personal preference.

The next page Reference gives you all the details around authentication, complete request/response, etc.

  1. User searches for popular vegetarian recipes

    Search with flexible parameters which returns matching recipes with complete meta data. In this example, the user searches for popular vegetarian recipes, and gets a Broccoli Soup and Banana Pancakes back as results.

    Request

    curl https://api.northfork.se/api/discovery/recipes?diets=vegetarian&order_by=popularity
    

    Response

    [
      {
        "id": 12345,
        "external_id": "ABC555111",
        "title": "Broccoli soup",
        "portions": 4,
        "source_url": "https://somesite.com/recipe/broccoli_soup",
        "images": [
          {
            "url": "https://img.somesite.com/broccoli_soup.png"
          }
        ],
        "cooking_time": 30
      },
      {
        "id": 98765,
        "external_id": "XYZ998877",
        "title": "Banana pancakes",
        "portions": 4,
        "source_url": "https://somesite.com/recipe/banana_pancakes",
        "images": [
          {
            "url": "https://img.somesite.com/banana_pancakes.png"
          }
        ],
        "cooking_time": 45
      }
    ]
    

    Only some of the actual fields and only a couple of example recipes are included in the response above, see the Reference section for full description.

  2. User adds the first two recipes to cart

    The Resolve method is used to get matching products for chosen recipes. In this example, the user adds both the Broccoli Soup and Banana Pancakes to cart and we get products optimized for lowest price.

    Request

    curl -X POST https://api.northfork.se/api/smart-cart/recipes/resolve 
      -H "Content-Type: application/json" 
       -d 
       '
        {
          "recipes": [
            {
              "external_id": "ABC5555111",
              "portions": 4
            },
            {
              "external_id": "XYZ998877",
              "portions": 4
            }
          ],
          "options": {
            "calculation": "price"
          },
        }'
    

    Response

    {
      "products": [
        [
          {
            "id": 878787,
            "external_id": "P113355",
            "name": "Broccoli",
            "image_url": "https://img.somesite.com/products/broccoli.png",
            "quantity": 2,
            "size": 250,
            "size_unit_name": "g",
            "price": 244,
            "common": false,
            "substitute_identifier": "4b496109-99ce-4b9f-aece-25301bda833d"
          }
        ],
        [
          {
            "id": 343536,
            "external_id": "P554433",
            "name": "Vegetable Broth",
            "image_url": "https://img.somesite.com/products/broth_veg.png",
            "quantity": 1,
            "size": 240,
            "size_unit_name": "ml",
            "price": 197,
            "common": true,
            "substitute_identifier": "a9201ed5-0aa6-4269-96e1-6d763f965907"
          }
        ]
      ]
    }
    

    Only some of the actual fields and only a couple of example products are included in the response above, see the Reference section for full description.

  3. User substitutes a product to an organic alternative

    The Substitute method is used to list alternative products that a user can change to for a certain ingredient. In this example, the user wants to change to an organic Broccoli and finds both an organic and a frozen alternative.

    Request

    curl https://api.northfork.se/api/smart-cart/stores/store1234/products/4b496109-99ce-4b9f-aece-25301bda833d/substitutes
    

    Response

    [
      {
        "name": "Broccoli, organic",
        "size": 250,
        "size_unit_name": "g",
        "price": 287
      },
      {
        "name": "Frozen broccoli",
        "size": 500,
        "size_unit_name": "g",
        "price": 379
      }
    ]
    

    Only some of the actual fields and only a couple of example recipes are included in the response above, see the Reference section for full description.

Search for recipes

Examples coming soon, please see the Reference section in the mean time for full API details.

Find matching products

Examples coming soon, please see the Reference section in the mean time for full API details.

Substitute products

Examples coming soon, please see the Reference section in the mean time for full API details.