{"id":15322138,"url":"https://github.com/edmartt/rest-fut21","last_synced_at":"2026-02-19T06:30:54.466Z","repository":{"id":36968040,"uuid":"391872759","full_name":"Edmartt/rest-fut21","owner":"Edmartt","description":"A REST api demo based on FUT21 api","archived":false,"fork":false,"pushed_at":"2023-08-15T06:48:14.000Z","size":190,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T15:51:23.885Z","etag":null,"topics":["api","flask","python","rest","rest-api","restful-api"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Edmartt.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":"2021-08-02T08:37:48.000Z","updated_at":"2022-04-29T04:23:20.000Z","dependencies_parsed_at":"2025-02-12T19:32:45.132Z","dependency_job_id":"7a3fb41b-c996-467e-bcda-807cd215f43a","html_url":"https://github.com/Edmartt/rest-fut21","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Edmartt/rest-fut21","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Frest-fut21","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Frest-fut21/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Frest-fut21/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Frest-fut21/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edmartt","download_url":"https://codeload.github.com/Edmartt/rest-fut21/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edmartt%2Frest-fut21/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29604764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T05:11:50.834Z","status":"ssl_error","status_checked_at":"2026-02-19T05:11:38.921Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api","flask","python","rest","rest-api","restful-api"],"created_at":"2024-10-01T09:14:18.905Z","updated_at":"2026-02-19T06:30:54.450Z","avatar_url":"https://github.com/Edmartt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# REST-FUT21\n\n## Install on Virtualenv\n\nAfter cloning, a virtual environment must be created. On Linux:\n\n\t$ python3 -m venv virtualenv name \n\t$ source env/bin/activate\n\t(virtualenv name)$ pip3 install requirements.txt\n\nOn Windows:\n\n\t$ python -m venv virtualenv name\n\t$ venv\\Scripts\\activate\n\t(virtualenv name)$ pip install requirements.txt\n\n## Running\n\n### Note\n\nThe database server can be MySQL/MariaDB. The database must be created first of all.\n\nTo run the server, you have to set the environment variables. On Windows:\n\n\t$ set MYSQL_HOST=hostname (localhost)\n\t$ set MYSQL_USER=server username\n\t$ set MYSQL_PASSWORD=server password\n\t$ set MYSQL_DATABASE=database name\n\t$ set API_KEY= header x-api-key value\n\t$ set FLASK_APP=run.py\n\t$ set FLASK_ENV=development\n\nOn Linux:\n\n\t$ export MYSQL_HOST=hostname (localhost)\n\t$ export MYSQL_USER=server username\n\t$ export MYSQL_PASSWORD=server password\n\t$ export MYSQL_DATABASE=database name\n\t$ export API_KEY= header x-api-key value\n\t$ export FLASK_APP=run.py\n\t$ export FLASK_ENV=development\n\n\n\nFinally, the following instruction must be used, on Linux and Windows:\n\n\t$ flask init-db \n\t$ flask run\n\n## Docker deployment:\n\n\nA .env file is needed for the environment variables\n\t\n\tMYSQL_HOST=db (the services name is the host, so you'll need exactly this name)\n\tMYSQL_USER=your_username\n\tMYSQL_PASSWORD=server_password\n\tMYSQL_DATABASE=database_name\n\tAPI_KEY=your_x_api_key\n\tFLASK_RUN_HOST=0.0.0.0\n\tFLASK_APP=run.py\n\tFLASK_ENV=development\n\nAfter that just do the following:\n\n    $ docker-compose build\n    # docker-compose up\n\n### NOTE\n\nOnce the deployment is complete, we can make use of the datagetter script [datagetter](https://github.com/Edmartt/datagetter) to collect the data and perform the respective tests on the different endpoints of the REST API.\n\n\n\n\n\nAPI Documentation\n-----------------------\n\n### Show Players\n\nReturns all the players that belong to a team. The right **x-api-key** header must be sent.\n\n* **URL** \n\n  /api/v1/team/:team_name\n\n* **Methods:**\n  \n  `GET`\n\n* **URL Parameters**\n\n  **Required:**\n\n  `name=[string]`\n\n* **Success Response:**\n\n  * **Code:** 200 \u003cbr /\u003e\n    **Content:** `{club: Icons, id: 9, name: Diego Armando Maradona, nation: Argentina, position: CAM}`\n\n* **Error Response:**\n  \n  * **Code:** 404 NOT FOUND \u003cbr /\u003e\n    **Content:** `{Error: Not Found}`\n\n   Or\n\n  * **Code:** 401 UNAUTHORIZED \u003cbr /\u003e\n    **Content:** `{message: Not Authorized}`\n\n\n### Search Coincidences:\n\nReturns the players data searched by partial or full name, returning all the coincidences.\u003cbr /\u003e Sort the results in a ascending or descending way. By default, the order is ascending. The right x-api-key header must be sent.\n\n* **URL** \n\n  /api/v1/players?search=name\u0026order=\n\n* **Methods:**\n  \n  `GET`\n\n* **URL Parameters**\n\n  **Required:**\n\n  `name=[string o char]`\n  \n  **Optional:**\n\n  `order=[asc o desc]`\n\n* **Success Response:**\n\n  * **Code:** 200 \u003cbr /\u003e\n    **Content:** `{club: FC Barcelona, id: 14, name: Luis Suárez, nation: Uruguay, position: ST}, {club: Real Madrid, id: 2, name: Luka Modric, nation: Croatia, position: CM}`\n\n* **Error Response:**\n  \n  * **Code:** 404 NOT FOUND \u003cbr /\u003e\n    **Content:** `{Error: Not Found}`\n\n   Or\n\n  * **Code:** 401 UNAUTHORIZED \u003cbr /\u003e\n    **Content:** `{message: Not Authorized}`\n\n### Example\n\nWith a tool like `curl` we can make a request to the endpoint **/api/v1/team/** sending the **x-api-key** header:\n\n    $ curl -i -H \"x-api-key: 1234\" -X GET http://localhost:5000/api/v1/team/Icons\n    HTTP/1.0 200 OK\n    Content-Type: application/json\n    Content-Length: 675\n    Server: Werkzeug/2.0.1 Python/3.7.11\n    Date: Thu, 05 Aug 2021 06:16:27 GMT\n\n    [\n    {\n        \"club\": \"Icons\",\n\t\"id\": 9,\n\t\"name\": \"Edson Arantes Nascimento\",\n\t\"nation\": \"Brazil\",\n\t\"position\": \"CAM\"\n\t\t\t  \n    },\n    {\n        \"club\": \"Icons\",\n\t\"id\": 23,\n\t\"name\": \"Diego Maradona\",\n\t\"nation\": \"Argentina\",\n\t\"position\": \"CAM\"\n\t\t\t  \n    },\n    {\n        \"club\": \"Icons\",\n\t\"id\": 36,\n\t\"name\": \"Ronaldo Luis Nazário de Lima\",\n\t\"nation\": \"Brazil\",\n\t\"position\": \"ST\"\n\t\t\t  \n    },\n    {\n        \"club\": \"Icons\",\n\t\"id\": 81,\n\t\"name\": \"Edson Arantes Nascimento\",\n\t\"nation\": \"Brazil\",\n\t\"position\": \"CAM\"\n\t\t\t  \n    },\n    {\n        \"club\": \"Icons\",\n\t\"id\": 95,\n\t\"name\": \"Diego Maradona\",\n\t\"nation\": \"Argentina\",\n\t\"position\": \"CAM\"\n\t\t\t  \n      }\n    ]\n\nIf we do the request without the **x-api-key** header:\n\n    $ curl -i -X GET http://localhost:5000/api/v1/team/Icons\n    HTTP/1.0 401 UNAUTHORIZED\n    Content-Type: application/json\n    Content-Length: 34\n    Server: Werkzeug/2.0.1 Python/3.7.11\n    Date: Thu, 05 Aug 2021 06:21:28 GMT\n\n    {\n    \t\"message\": \"Not Authorized\"\n    }\n\nIf we do the request with a wrong **x-api-key** header:\n\n    $ curl -i -H \"x-api-key: 1234i\" -X GET http://localhost:5000/api/v1/team/Icons\n    HTTP/1.0 401 UNAUTHORIZED\n    Content-Type: application/json\n    Content-Length: 34\n    Server: Werkzeug/2.0.1 Python/3.7.11\n    Date: Thu, 05 Aug 2021 06:24:42 GMT\n    {\n      \"message\": \"Not Authorized\"\n    }\n\nThe endpoint **/api/v1/players** works like this:\n\n    $ curl -i -H \"x-api-key: 1234\" -X GET http://localhost:5000/api/v1/players?search=d\n\n    [\n     {\n      \"club\": \"Manchester United\",\n      \"id\": 27,\n      \"name\": \"David De Gea Quintana\",\n      \"nation\": \"Spain\",\n      \"position\": \"GK\"\n\t\t      \n    },\n    {\n     \"club\": \"Atlético Madrid\",\n     \"id\": 40,\n     \"name\": \"Diego Godín\",\n     \"nation\": \"Uruguay\",\n     \"position\": \"CB\"\n\t\t      \n    },\n    {\n     \"club\": \"Icons\",\n     \"id\": 23,\n     \"name\": \"Diego Maradona\",\n     \"nation\": \"Argentina\",\n     \"position\": \"CAM\"\n\t\t      \n    },\n    {\n     \"club\": \"Icons\",\n     \"id\": 95,\n     \"name\": \"Diego Maradona\",\n     \"nation\": \"Argentina\",\n     \"position\": \"CAM\"\n\t\t      \n      }\n    ]\n\nThe result is to return all the players whose names begin with the letter d. If an additional querystring is sent **order** \u003cbr /\u003e\nwe can reverse the order in which the players are displayed:\n\n    $ curl -i -H \"x-api-key: 1234\" -X GET \"http://localhost:5000/api/v1/players?search=d\u0026order=desc\"\n\n    [\n     {\n     \"club\": \"Icons\",\n     \"id\": 23,\n     \"name\": \"Diego Maradona\",\n     \"nation\": \"Argentina\",\n     \"position\": \"CAM\"\n     },\n     {\n     \"club\": \"Icons\",\n     \"id\": 95,\n     \"name\": \"Diego Maradona\",\n     \"nation\": \"Argentina\",\n     \"position\": \"CAM\"\n     },\n     {\n     \"club\": \"Atlético Madrid\",\n     \"id\": 40,\n     \"name\": \"Diego Godín\",\n     \"nation\": \"Uruguay\",\n     \"position\": \"CB\"\n     },\n     {\n     \"club\": \"Manchester United\",\n     \"id\": 27,\n     \"name\": \"David De Gea Quintana\",\n     \"nation\": \"Spain\",\n     \"position\": \"GK\"\t\t      \n     }\n    ]\n\n## Credits\n\n* [Edmartt's Profile](https://github.com/Edmartt)\n  - The developer of this REST API Demo\n\n* [vishnubob's Profile](https://github.com/vishnubob)\n  - for the development of the [wait-for-it script](https://github.com/vishnubob/wait-for-it)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmartt%2Frest-fut21","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedmartt%2Frest-fut21","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedmartt%2Frest-fut21/lists"}