{"id":15622759,"url":"https://github.com/nbaztec/potions-rest-api","last_synced_at":"2025-03-29T16:27:52.815Z","repository":{"id":145696252,"uuid":"69641175","full_name":"nbaztec/potions-rest-api","owner":"nbaztec","description":null,"archived":false,"fork":false,"pushed_at":"2016-09-30T06:46:13.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T17:28:22.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nbaztec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-09-30T06:45:56.000Z","updated_at":"2016-09-30T06:46:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ca21152-ca71-4261-b8c1-8e1e6c9430c9","html_url":"https://github.com/nbaztec/potions-rest-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbaztec%2Fpotions-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbaztec%2Fpotions-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbaztec%2Fpotions-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nbaztec%2Fpotions-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nbaztec","download_url":"https://codeload.github.com/nbaztec/potions-rest-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246210784,"owners_count":20741229,"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":[],"created_at":"2024-10-03T09:55:07.976Z","updated_at":"2025-03-29T16:27:52.796Z","avatar_url":"https://github.com/nbaztec.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\nTest potions is a simple REST test service that exposes the following end points:\n\n \n## Authorization\n\nThe service is protected by a secret key that is set at the server level.  \nAll API communication expects an `Authorization` header \ncontaining the **base64 encoded** secret key as the header value. \n\nThe default secret key is: **mixOfRandomPotions**\n\n\n## GET, POST /\n\n\nCheck API health.\n\n**status** string  \n**version** string\n\n\n## GET /list\n\nRetrieve list of potions.\n\n**items** list of potions having the format:  \n* **id** integer\n* **name** string\n\n\n## GET /item?id=XX\n\nRetrieve detailed information about a single potion.\n\n**item** list of potions having the format:  \n* **id** integer\n* **name** string\n* **toxicity** float\n\n\n## POST /mix\n\nMix 2 or more potions and return the final toxicity.\n\nRequest JSON body:\n\n**ids** list of potion IDs. Eg: `{ \"ids\": [2, 5, 6] }` \n\n\u0026nbsp;\n\nResponse JSON body:\n\n**toxicity** Resulting toxicity achieved by mixing the requested potions\n\n\n# Run\n\n```\n$ go build\n$ ./potions-rest-api\n```\n\n# Test\n\n```\n$ go test ./...\n$ go test ./... -cover\n```\n\n\n# CURL Examples\n\n```\n$ curl -H 'Authorization:XXXXX' /\n{\"status\":\"Ok\",\"version\":\"1.0\"}\n  \n$ curl -H 'Authorization:XXXXX' /list\n{\"items\":[{\"id\":1,\"string\":\"Acidic Tonic\"},{\"id\":2,\"string\":\"Brew of Exalted Cats\"},{\"id\":....\n  \n$ curl -H 'Authorization:XXXXX' /item?id=1\n{\"item\":{\"id\":1,\"string\":\"Acidic Tonic\",\"toxicity\":10.5}}\n  \n$ curl -X POST -H 'Authorization:XXXX' /mix --data '{\"ids\": [1,2,3]}'\n{\"toxicity\":55.9}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbaztec%2Fpotions-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnbaztec%2Fpotions-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnbaztec%2Fpotions-rest-api/lists"}