{"id":16059593,"url":"https://github.com/talaatmagdyx/api-versioning","last_synced_at":"2026-04-12T22:14:33.762Z","repository":{"id":109180166,"uuid":"230120288","full_name":"talaatmagdyx/API-Versioning","owner":"talaatmagdyx","description":"simple example explain how to create different API version using Ruby (Sinatra)","archived":false,"fork":false,"pushed_at":"2019-12-25T15:31:31.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T15:50:48.223Z","etag":null,"topics":["api-documentation","json","json-api","ruby","sinatra"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/talaatmagdyx.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":"2019-12-25T15:24:30.000Z","updated_at":"2023-02-05T11:36:41.000Z","dependencies_parsed_at":"2023-04-06T16:39:53.808Z","dependency_job_id":null,"html_url":"https://github.com/talaatmagdyx/API-Versioning","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/talaatmagdyx%2FAPI-Versioning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talaatmagdyx%2FAPI-Versioning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talaatmagdyx%2FAPI-Versioning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/talaatmagdyx%2FAPI-Versioning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/talaatmagdyx","download_url":"https://codeload.github.com/talaatmagdyx/API-Versioning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305946,"owners_count":20917208,"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":["api-documentation","json","json-api","ruby","sinatra"],"created_at":"2024-10-09T04:01:25.054Z","updated_at":"2025-10-16T16:16:21.258Z","avatar_url":"https://github.com/talaatmagdyx.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## API Version Types\n\n### Technologies used\n    - Ruby 2.5.0\n    - sinatra\n### Run Any Script \n\t`ruby nameOfScript.rb`\n### how to access different version of Api\n- Versioning Via Subdomain\n\t- configuration before\n      \t- if  deploy this little application and point the two domain names api1.example.com and api2.example.com\n     \t - we need to add an external gem called sinatra-subdomain.\n\t`gem install sinatra-subdomain`\n\n-  Versioning In The URL\n\t- configuration before\n\t\t- install the sinatra-contrib gem to use namespaces\n\t\t\t- `gem install sinatra-contrib`\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/v1/users`\n\t\t\t- output\n\t\t\t\t```json\n                [\n  \t\t\t\t\t{\"first_name\":\"Thibault\", \"last_name\":\"Denizet\", \"age\":25},\n  \t\t\t\t\t{\"first_name\":\"Simon\", \"last_name\":\"Random\", \"age\":26},\n      \t\t\t\t{\"first_name\":\"John\", \"last_name\":\"Smith\", \"age\":28}\n\t\t\t\t]\n                ```\n\t\t- Getting the v2 representation:\n\t\t\t- `curl http://localhost:4567/v2/users`\n\t\t\t- output\n\t\t\t\t```json\n            \t[\n  \t\t\t\t\t{\"full_name\":\"Thibault Denizet\", \"age\":25},\n  \t\t\t\t\t{\"full_name\":\"Simon Random\", \"age\":26},\n  \t\t\t\t\t{\"full_name\":\"John Smith\", \"age\":28}\n\t\t\t\t]\n                ```\n-  Versioning In The URL With a Parameter\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/users?version=v1`\n\n\t\t- Getting the v2 representation:\n\t\t\t- `curl http://localhost:4567/users?version=v2`\n\n- Versioning In A Custom Header\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/users -H 'Version: 1.0'`\n\n\t\t- Getting the v2 representation:\n\t\t\t- `curl http://localhost:4567/users -H 'Version: 2.0'`\n\n- Versioning With A Custom Media Type\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/users - H'Accept:application/vnd.awesomeapi.v1+json''`\n\n\t\t- Getting the v2 representation:\n\t\t\t- `curl http://localhost:4567/users - H'Accept:application/vnd.awesomeapi.v2+json''`\n\n- Versioning In A Custom Header\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/users \\\n  -H 'Accept: application/vnd.awesomeapi+json; version=1'`\n\n\t\t- Getting the v2 representation:\n\t\t\t- `curl http://localhost:4567/users \\\n  -H 'Accept: application/vnd.awesomeapi+json; version=2''`\n\n- No Version.\n\t- test use `Curl`\n\t\t- Getting the v1 representation:\n\t\t\t- `curl http://localhost:4567/users `\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalaatmagdyx%2Fapi-versioning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalaatmagdyx%2Fapi-versioning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalaatmagdyx%2Fapi-versioning/lists"}