Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.43 KB

README.md

File metadata and controls

50 lines (32 loc) · 1.43 KB

Golang FatSecret API Client

Will eventually implement all of the FatSecret API.

You must set the following environment variables in order to access the FatSecret API...

  1. "FATSECRET_CONSUMER_KEY"
  2. "FATSECRET_CONSUMER_SECRET"

FatSecret Client Example

Use the 'fatsecret_client' cli application as a working example...

$ go run cmd/fatsecret_client/main.go

FS2JSON Example

Use the 'fs2json' cli tool to invoke FatSecret API calls and dump the JSON response...

# search for coffee
$ go run cmd/fs2json/main.go -method foods.search -params search_expression=coffee | jq .

# list the food categories
$ go run cmd/fs2json/main.go -method food_categories.get

# list the food sub-categories for a category
$ go run cmd/fs2json/main.go -method food_sub_categories.get -params food_category_id=16 | jq .

# list the brands for a brand-type
$ go run cmd/fs2json/main.go -method food_brands.get -params brand_type=manufacturer | jq .

# auto-complete
$ go run cmd/fs2json/main.go -method foods.autocomplete -params expression=chic | jq .

# find food-id by barcode
$ go run cmd/fs2json/main.go -method food.find_id_for_barcode -params barcode=0748927052688 | jq .

# get food info by id
$ go run cmd/fs2json/main.go -method food.get -params food_id=2415647 | jq .

References

Made with 💚 in Campbell, CA