food.find_id_for_barcode

Description

Returns the food_id matching the barcode specified.

Barcodes must be specified as GTIN-13 numbers - a 13-digit number filled in with zeros for the spaces to the left.

UPC-A, EAN-13 and EAN-8 barcodes may be specified.

UPC-E barcodes should be converted to their UPC-A equivalent (and then specified as GTIN-13 numbers).

Localization (Premier Only):

Two additional optional parameters named region and language are available to premier clients. More information can be found in the Localization guide.

Parameters

Required

Name Type Description
method String MUST be "food.find_id_for_barcode"
barcode String The 13-digit GTIN-13 formated sequence of digits representing the barcode to search against.

Optional

Name Type Description
format String The desired response format. Valid reponse formats are "xml" or "json" (default value is "xml").

Response

The result of the call is the food id which matches the barcode specified (0 if no match was found).

Example Return XML

<?xml version="1.0" encoding="utf-8" ?>
<food_id xmlns="http://platform.fatsecret.com/api/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://platform.fatsecret.com/api/1.0/ http://platform.fatsecret.com/api/1.0/fatsecret.xsd">4384</food_id>

Example Return JSON

{ "food_id": {"value": "4384" }}

Error Code

Code Description
13 Invalid token: "<detail>"
101 Missing required parameter: "<detail>"
FatSecret Sites
For Developers

For Professionals

For Everyone

FatSecret Platform API

Developers

Support
API

About FatSecret

© 2023 FatSecret. All rights reserved.