{"id":15704293,"url":"https://github.com/rstub/fs-api","last_synced_at":"2025-08-09T15:31:34.327Z","repository":{"id":161223743,"uuid":"203205932","full_name":"rstub/fs-api","owner":"rstub","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-20T11:12:14.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T15:56:32.313Z","etag":null,"topics":["java","rest-api","spring","spring-boot"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-19T16:04:43.000Z","updated_at":"2019-08-20T11:12:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"a07da26d-579a-48c4-8e57-e6cdf829198c","html_url":"https://github.com/rstub/fs-api","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"6ba58f058ac185a0d54c9b455c65caa4be6da0e0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstub%2Ffs-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstub%2Ffs-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstub%2Ffs-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstub%2Ffs-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstub","download_url":"https://codeload.github.com/rstub/fs-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229298257,"owners_count":18051239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","rest-api","spring","spring-boot"],"created_at":"2024-10-03T20:11:12.160Z","updated_at":"2024-12-11T22:06:07.652Z","avatar_url":"https://github.com/rstub.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fs-api\n\nThe `fs-api` provides a REST API for the\n[FatSecret](https://fatsecret.com) service. See the [architecture\ndocumentation](docs/architecture.md) for an overview.\n\n## Usage\n\nIn order to use `fs-api` one needs to\n[register](https://platform.fatsecret.com/) to obtain OAuth 1.0\nCredentials. These Consumer Key and Consumer Secret have to be provided\nto `fs-api` as environment variables. Assuming a `bash` like shell:\n\n```bash\n$ export FATSECRET_CONSUMER_KEY=...\n$ export FATSECRET_CONSUMER_SECRET=...\n```\n\nAfter that the application can be started from the top-level application\ndirectory as\n\n```bash\n$ mvnw spring-boot:run\n```\n\nAlternativly you can split the tasks of building the (fat) JAR file from\nexecuting it:\n\n```bash\n$ mvnw package\n$ java -jar target/fs-api-0.0.1-SNAPSHOT.jar\n```\n\nFor tests it is helpful to have a JSON pretty printer like `jq`\navailable:\n\n```bash\n$ curl --silent http://localhost:8080/api/v1/food?q=avocado | jq\n[\n  {\n    \"name\": \"Avocado\",\n    \"url\": \"https://www.fatsecret.com/calories-nutrition/calavo/avocado\",\n    \"type\": \"Brand\",\n    \"id\": 66325,\n    \"description\": \"Per 1/2 medium avocado - Calories: 130kcal | Fat: 12.00g | Carbs: 6.00g | Protein: 1.00g\",\n    \"brandName\": null\n  },\n  {\n    \"name\": \"Avocados\",\n    \"url\": \"https://www.fatsecret.com/calories-nutrition/usda/avocados\",\n    \"type\": \"Generic\",\n    \"id\": 35752,\n    \"description\": \"Per 100g - Calories: 160kcal | Fat: 14.66g | Carbs: 8.53g | Protein: 2.00g\",\n    \"brandName\": null\n  },\n  {\n    \"name\": \"Hass Avocado\",\n    \"url\": \"https://www.fatsecret.com/calories-nutrition/trader-joes/hass-avocado\",\n    \"type\": \"Brand\",\n    \"id\": 270988,\n    \"description\": \"Per 1/5 medium  - Calories: 50kcal | Fat: 4.50g | Carbs: 3.00g | Protein: 0.00g\",\n    \"brandName\": null\n  },\n  ...\n]\n$ curl --silent http://localhost:8080/api/v1/food/35752 | jq\n{\n  \"name\": \"Avocados\",\n  \"url\": \"https://www.fatsecret.com/calories-nutrition/usda/avocados\",\n  \"type\": \"Generic\",\n  \"id\": 35752,\n  \"description\": null,\n  \"brandName\": \"\",\n  \"servings\": [\n    {\n      \"servingId\": 32965,\n      \"servingDescription\": \"1 cup cubed\",\n      \"servingUrl\": \"https://www.fatsecret.com/calories-nutrition/usda/avocados?portionid=32965\u0026portionamount=1.000\",\n      \"metricServingAmount\": 150,\n      \"metricServingUnit\": \"g\",\n      \"numberOfUnits\": 1,\n      \"measurementDescription\": \"cup, cubes\",\n      \"calories\": 240,\n      \"carbohydrate\": 12.8,\n      \"protein\": 3,\n      \"fat\": 21.99,\n      \"saturatedFat\": 3.189,\n      \"polyunsaturatedFat\": 2.724,\n      \"monounsaturatedFat\": 14.698,\n      \"transFat\": null,\n      \"cholesterol\": 0,\n      \"sodium\": 10,\n      \"potassium\": 728,\n      \"fiber\": 10,\n      \"sugar\": 0.99,\n      \"vitaminA\": 4,\n      \"vitaminC\": 25,\n      \"calcium\": 2,\n      \"iron\": 5\n    },\n    ...\n  ]\n}\n```\n## Deployment\n\nThe API can be packaged as a Docker image with\n\n```bash\n$ mvnw install dockerfile:build\n```\n\nThe resulting image can be run with\n\n```bash\n$ docker run -d --rm -p 8080:8080 \\\n    -e FATSECRET_CLIENT_ID -e FATSECRET_CLIENT_SECRET \\\n    rstub/fs-api\n```\n\nIf the docker container is run some other way (`docker-compose`,\nkubernetes, ...) the port-forwarding and environment variables have to\nbe defined in the run-time configuration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstub%2Ffs-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstub%2Ffs-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstub%2Ffs-api/lists"}