Important An API key is required for access to this API. * Get a Food Data API key at https://chompthis.com/api. * Get a Recipe Data API key at https://chompthis.com/api/recipes. ### Getting Started * Subscribe to the Food Data API or the Recipe Data API. * Scroll down and click the "Authorize" button. * Enter your API key into the "value" input, click the "Authorize" button, then click the "Close" button. * Scroll down to the section titled "default" and click on the API endpoint you wish to use. * Click the "Try it out" button. * Enter the information the endpoint requires. * Click the "Execute" button. ### Example * Branded food response object: View example » * Ingredient response object: View example » * Recipe response object: View example » * Error response object: View example » ### How Do I Find My API Key? * Your API key was sent to the email address you used to create your subscription. * You will also find your API key in the Client Center. * Read this article for more information. ### I'm a Premium subscriber. How do I access the API? * All Premium subscribers must pass in a unique user ID for each user on their platform that is accessing data from the Chomp API. A user ID can be any string of letters and numbers that you assign to your user. Simply add "user_id" as a URL parameter when calling the API. You must add a "user_id" URL parameter to every call you make to ANY endpoint. * Example > ENDPOINT.php?api_key=API_KEY&code=CODE&user_id=USER_ID
### Helpful Links * Help & Support * Knowledge Base » * Support » * Client Center » * Pricing * Food Data API Subscription Options » * Recipe Data API Subscription Options » * Food Data API Cost Calculator » * Recipe Data API Cost Calculator » * Guidelines * Terms & License » * Attribution »
This C# SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0-oas3
- SDK version: 1.0.0
- Build package: io.swagger.codegen.v3.generators.dotnet.CSharpClientCodegen
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)
- RestSharp - 105.1.0 or later
- Json.NET - 7.0.0 or later
- JsonSubTypes - 1.2.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out IO.Swagger.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
var apiInstance = new DefaultApi();
var code = code_example; // string | #### UPC/EAN barcode **Example** > ```&code=0842234000988```
var userId = userId_example; // string | #### **Only required for Premium subscribers.** The unique identifier assigned to each user on your platform. This can be any string of letters or numbers and doesn't have to relate to your own database. [Learn more](https://desk.zoho.com/portal/chompthis/en/kb/articles/monthly-active-users) **Example** > ```&user_id=fehef8w4ha``` (optional)
try
{
// Get a branded food item using a barcode
BrandedFoodObject result = apiInstance.FoodBrandedBarcodePhpGet(code, userId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.FoodBrandedBarcodePhpGet: " + e.Message );
}
}
}
}
All URIs are relative to https://chompthis.com/api/v2
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | FoodBrandedBarcodePhpGet | GET /food/branded/barcode.php | Get a branded food item using a barcode |
DefaultApi | FoodBrandedNamePhpGet | GET /food/branded/name.php | Get a branded food item by name |
DefaultApi | FoodBrandedSearchPhpGet | GET /food/branded/search.php | Get data for branded food items using various search parameters |
DefaultApi | FoodIngredientSearchPhpGet | GET /food/ingredient/search.php | Get raw/generic food ingredient item(s) |
DefaultApi | RecipeIdPhpGet | GET /recipe/id.php | Get a recipe by ID |
DefaultApi | RecipeIngredientPhpGet | GET /recipe/ingredient.php | Get recipes using a list of ingredients |
DefaultApi | RecipeRandomPhpGet | GET /recipe/random.php | Get random popular recipes |
DefaultApi | RecipeSearchPhpGet | GET /recipe/search.php | Get recipes using a title and optional filters |
- Model.BrandedFoodObject
- Model.BrandedFoodObjectCountryDetails
- Model.BrandedFoodObjectDietFlags
- Model.BrandedFoodObjectDietLabels
- Model.BrandedFoodObjectDietLabelsGlutenFree
- Model.BrandedFoodObjectDietLabelsVegan
- Model.BrandedFoodObjectDietLabelsVegetarian
- Model.BrandedFoodObjectItems
- Model.BrandedFoodObjectNutrients
- Model.BrandedFoodObjectPackage
- Model.BrandedFoodObjectPackagingPhotos
- Model.BrandedFoodObjectPackagingPhotosFront
- Model.BrandedFoodObjectPackagingPhotosIngredients
- Model.BrandedFoodObjectPackagingPhotosNutrition
- Model.BrandedFoodObjectServing
- Model.IngredientObject
- Model.IngredientObjectCalorieConversionFactor
- Model.IngredientObjectComponents
- Model.IngredientObjectItems
- Model.IngredientObjectNutrients
- Model.IngredientObjectPortions
- Model.RecipeObject
- Model.RecipeObjectAttributes
- Model.RecipeObjectIngredients
- Model.RecipeObjectItems
- Model.RecipeObjectMeta
- Model.RecipeObjectMetaImages
- Model.RecipeObjectNutrients
- Model.RecipeObjectNutrientsCalories
- Type: API key
- API key parameter name: api_key
- Location: URL query string