This is the documentation page about the foodspex API. Here you can find everything you'll need to know to connect with the web service and fetch data from it.

To request a user API key, please submit the form at the right side of this page.

If you are experiencing troubles or difficulties with the foodspex web service, you can contact foodspex by submitting a message with the contact form.

Click a topic to navigate to the detailed section.

To request an API key, please complete and submit the form below.
 
 
  • introduction

    foodspex provides an API through a JSON web service, which let developers fetch data (chapters, products, ...) from the foodspex database .
    This service is available at http://www.foodspex.com/foodspexService.asmx.

    For every web service call that is made, a user API key should be provided. You can retrieve an API key by submitting the form at the right side of this page.

  • .NET JSON web service

    • JSON
      The foodspex web service always returns objects in JSON notation. This is a very simple and straight forward manner and can be consumed by javascript very easily.

      For more information about JSON, please take a look at http://www.json.org/

    • wrapper class
      Because the foodspex web service is a developped in .NET, every object returned by the service is wrapped in a "d"-object. This means that every object has a property "d", which will contain the actual data.

      When the "d"-object is unwrapped, you'll notice that the actual data is wrapped in a status object, containing 2 properties: "Result" and "Data".
      • Result is a flag field, returning "success" or "failure".
      • Data is the actual data container. When the result states "success", the data will be the object you should expect from the service. When result contains the "failure" string, the data object will contain an error message.

      So in JSON notation, the objects returned from the foodspex web service will look like this:
      { 
          d : { 
              Result : 'success', 
              Data : { 
                  <data> 
              } 
          } 
      }
      Notice that if the result contains "success", but the data contains "null", the call was returned successful from the server, but there was just no data present.
  • calls

    • get chapters
      Get an overview of all the chapters.
      request method: /GetChapters
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      response: Array of chapters
    • get paragraphs
      Get an overview of all the paragraphs, contained by a certain chapter.
      request method: /GetParagraphs
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      chapterID int yes the ID of the chapter you'ld like to fetch paragraphs for
      response: Array of paragraphs
    • get brands
      Get an overview of all the brands.
      request method: /GetBrands
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      response: Array of brands
    • get products by name
      Get an overview of products where the name or the brand of the product contains the search value.
      /GetProductByName
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      productName string yes the name or brand name the fetched products will be filtered with
      response: Array of search products
    • get products by paragraphID
      Get an overview of products contained by a certain paragraph.
      request method: /GetProductByParagraphID
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      paragraphID int yes the ID of the paragraph the fetched products will be filtered with
      response: Array of search products
    • get products by brandID
      Get an overview of products of the given brand
      request method: /GetProductByBrandID
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      brandID GUID yes the ID of the brand the fetched products will be filtered with
      response: Array of search products
    • get products by GTIN
      Get an overview of products that have the given GTIN
      request method: /GetProductByGTIN
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      GTIN int yes the GTIN the fetched products will be filtered with
      response: Array of search products
    • get product
      Get the product that has the given ID
      request method: /GetProduct
      request parameters:
      name type mandatory description
      userAPIKey GUID yes your personal API key
      productID GUID yes the ID of the product to fetch
      response: product
  • data types

    • chapter
      attribute type description
      ID int the identifier of the chapter
      Description string the chapter name
      ImageUrl string the url of the online image of the chapter
      Paragraphs Array a list of all the paragraphs contained by the chapter
    • paragraph
      attribute type description
      ID int the identifier of the paragraph
      Description string the paragraph name
      ImageUrl string the url of the online image of the paragraph
      GProducts Array of GProducts a list of all the GProducts contained by the paragraph
    • GProduct
      attribute type description
      ID int the identifier of the GProduct
      Description string the GProduct name
    • brand
      attribute type description
      ID GUID the identifier of the brand
      Name string the name of the brand
      ImageUrl string the url of the online image of the brand
    • search product
      attribute type description
      ID GUID the identifier of the search product
      GTIN string the GTIN of the search product
      Name string the name of the search product
      ImageUrl string the online image url of the search product
      Brand Brand the brand of the search product
      PackageType PackageType the package type of the search product
      Chapter Chapter the chapter of the search product
      ShortNutritions Array of ShortNutritions An array of the 5 main nutritional values of the search product
    • product
      Product is an extention of search product, so product contains all the fields from search product extended with the fields listed below.
      attribute type description
      Ingredients string the ingredient list of the product
      Nutritions Array of Nutritions a list of all the nutritional values of the product
      Messages Array of strings a list of all the extra messages of the product (usually used for allergen information)
    • package type
      attribute type description
      ID GUID the identifier of the package type
      Description string the description of the package type
    • short nutrition
      Short nutritions are only used with search products, they list up the 5 most important nutritional values: energy, salt, sugar, fat and saturated fat.
      attribute type description
      Label string the name of the nutritional value
      Value string the actual nutritional value
      ValueLabel string the textual nutritional value (could be different from "Value", but mostly it's not)
      Unit string the unit of the nutritional value
    • nutrition
      attribute type description
      ID string the identifier of the nutritional value
      ProductID GUID the identifier of the product this nutritional value is part of
      Name string the name of the nutritional value
      Value string the actual nutritional value
      ValueLabel string the textual representation of the nutritional value (most of the time, this would be the same as "Value", but not necesseraly)
      Index int an number from 0 to 8, representing it's position towards the nutritional average of the paragraph that contains this product. 0 is below average where 8 is above average, 5 would be more or less the same as the nutritional average of the paragrahp.
      Unit string the unit of the nutritional value
      ADP string a percentage representing the average daily portion
      ADPLabel string the textual representation of the ADP (most of the time, this would be the same as "ADP", but not necesseraly)
      ImageUrl string the online image url of the product