Analyze recipes and nutrition with APILayer Food API

Few things affect our life more than food. It is a daily ritual that we participate in for a variety of reasons. Eating a meal with friends and family is the highlight of many people’s day. But more than that, food is the primary vehicle we use to get the nutrients our body needs to survive.

Yet food can also have a negative impact on our health. For example, consuming too much food usually causes weight gain and related health problems. Then there are allergies to certain foods which, if consumed, can make someone seriously ill or die. This is why it is so important for people to get accurate nutritional information about the food they eat.

The invention of the internet has obviously changed the way people get information. No matter what application you’re building, web, mobile, or even desktop, APILayer and Edamam’s food APIs can enable your applications to provide users with the accurate nutrition information they need.

What are APILayer and Edamam?

APILayer specializes in building web-based APIs. They’ve built dozens of API products used by large companies and millions of people, and to handle such a high level of load and demand, they’ve built a fast, scalable, and reliable infrastructure. Not only do they run their own APIs on their own infrastructure, but they also manage other companies’ APIs and make them available through APILayer Marketplace. Edamam Nutrition Oriented Bees are some of them.

Edamam is the leading provider of nutrition data and analytics and aims to capture the world’s food knowledge and break it down to help people make informed decisions at the store, restaurant and kitchen.

There are three Edamam APIs in the APILayer Marketplace:

The Nutritional Analysis API—Send the full text of any recipe or just an ingredient to retrieve the nutritional content.

The Food and groceries database API—Access Edamam’s food and groceries database, which contains 900,000 staple foods, restaurant items and packaged consumer foods. Filter them by diet and other health filters generated by Edamam.

The Recipe search API—Search Edamam’s extensive recipe database which contains 2.3 million recipes and their nutritional content.

Features: why use APILayer Food’s APIs?

If you are building food and nutrition based applications, you want to provide your users with the most accurate nutrition information available. APILayer Food APIs can do just that thanks to the following features:

Natural language processing

APILayer Food APIs use natural language processing. This means your users don’t need to use special words or jargon to get the nutrition information they want.

Complete nutritional analysis

Whether users want nutritional information for a single food or ingredient or a complete recipe, APILayer Food API provides complete nutritional analysis, including diet, allergy and health labels.

Edamam’s gigantic food database

Edamam’s food database consists of 900,000 staple foods, restaurant items, and consumer packaged foods. No matter what foods your users are looking for, Edamam is very likely to have the nutrition information for them.

Huge list of recipes

Your users can search 2.3 million recipes and filter the results by diet, calories, and other health filters, including chronic conditions like type 2 diabetes, kidney disease, and more.

Accurate nutritional data

Edamam is committed to providing the world with the most accurate nutrition information available.

Highly scalable

Food APIs run on APILayer’s cloud infrastructure and can meet your smallest and largest needs (as well as everyone else’s).

Unmatched speed

Your users will get their results in the blink of an eye thanks to APILayer’s ultra-fast infrastructure.

Uptime close to 100%.

While nothing is 100%, the uptime for APILayer’s services is as close as possible.

How does it work

Getting started with APILayer Food’s APIs is quick and easy. First, you need to create an APILayer account. Multiple accounts are not required to use multiple APIs. One account gives you access to all APILayer APIs, but an application ID and authentication key are required to successfully make requests.

APILayer control panelAPILayer control panelAPILayer control panel

To create an application, visit your account dashboard and click Applications form. There you can create an application and choose which API that application will access.

create an application in APILayercreate an application in APILayercreate an application in APILayer

After creating the application, you can view its details to retrieve the application ID and authentication keys.

retrieve the application ID and authentication keys.retrieve the application ID and authentication keys.retrieve the application ID and authentication keys.

Quick tutorial

APILayer allows you to make requests from any valid HTTP client, including JavaScript running inside the browser. For this tutorial, we will use vanilla JavaScript and the Fetch API to request data from the Nutrition Analytics API.

You can use the Nutrition Analysis API to request data for individual ingredients or for entire recipes. In this tutorial we will make a request for a single ingredient. To do this, we need to send a GET request to and provide the following query parameters:

  • app_id: the ID of our application
  • app_key: the authentication key of our application
  • ingr: the ingredient to be questioned

The Fetch API makes it easy to send GET requests with query parameters. First, create a new one URLSearchParams object like this:

This code initializes a URLSearchParam object with the required query parameters and their values. So, call fetch() and pass it the URL and paramsas shown below:

The API responds with JSON. So we need to parse it into an object with response.json(), and then we can do whatever we want with the resulting object. In the code above, we simply write the object to the console. The following screenshot shows the results:

results from writing the object to the consoleresults from writing the object to the consoleresults from writing the object to the console

As you can see, the Nutrition Analysis API provides a wealth of nutritional information about the ingredient.


If you are building food and nutrition applications and need an accurate source of nutritional information, then you need the APILayer Food APIs. Regardless of the API or subscription plan you choose, your users can benefit from natural language processing and accurate health, diet and allergy information. It is easy to use and easy to get started. So go to APILayer Marketplace and create an account today!

Source link

By LocalBizWebsiteDesign

Leave a Reply

Your email address will not be published. Required fields are marked *