Skip to content

Instantly share code, notes, and snippets.

@itoshkov
Created April 28, 2021 08:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itoshkov/740ccac36c3b91d47202489a957bf67a to your computer and use it in GitHub Desktop.
Save itoshkov/740ccac36c3b91d47202489a957bf67a to your computer and use it in GitHub Desktop.

Changes in version 2

Breaking changes

Entry point

The entry point for Recipe Search API v2 is https://api.edamam.com/api/recipes/v2.

Pagination

The way pagination works in recipe search API has changed significantly from version 1. The parameters from and to are no longer supported. Instead, responses will contain a pre-constructed URL for the next request in _links.next.href. If this path is not present, then this was the last page and there are no more results.

The type parameter

Each request now has to have a mandatory type parameter with the value public. This is added to enable us to add future extensions to the API without breaking the existing integrations.

Obtaining information about specific recipe

The r parameter is replaced with a URL path parameter. The search response now contains pre-constructed URLs for each returned recipe in hits[]._links.self.href.

If you have saved recipe URIs, which you were using with the r parameter in version 1, you would need to construct the new request manually.

A recipe URI has the form: http://www.edamam.com/ontologies/edamam.owl#recipe_0123456789abcdef0123456789abcdef. The part after #recipe_ is called the hash. A request to v1 in the form of

https://api.edamam.com/search?r=http%3A%2F%2Fwww.edamam.com%2Fontologies%2Fedamam.owl%23recipe_0123456789abcdef0123456789abcdef&app_id=YOUR_APP_ID&app_key=YOUR_APP_KEY

will become the following request in v2:

https://api.edamam.com/api/recipes/v2/0123456789abcdef0123456789abcdef?app_id=YOUR_APP_ID&app_key=YOUR_APP_KEY&type=public

The result of this request is just a single Hit, instead of an array. Please consult the Recipe Search API v2 documentation for details.

Filtering by cuisine, meal and dish type

Filtering by cuisine, meal and dish types has the same syntax as before, but with stricter semantics. For example specifying a cuisineType=Eastern%20Europe will not return recipes from other “eastern” or other “European” cuisines.

Non-breaking changes

Select result fields

Version 1 of the Recipe Search API returns the full information for each recipe. This make the result size large, which results in higher bandwith usage. Also, the processing of the response may require more CPU and RAM.

There are many use-cases where only a subset of the data is needed. In version 2 of the API one can use the field parameters to specify which parts of the results are needed. Please refer to the Recipe Search API v2 documentation for details.

@kevin2-cyber
Copy link

Finding it difficult to make api calls and migrate to version 2

@itoshkov
Copy link
Author

Finding it difficult to make api calls and migrate to version 2

You can see the official documentation here: https://developer.edamam.com/edamam-docs-recipe-api

If you have any questions, please use the support button there to ask them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment