{"id":18377065,"url":"https://github.com/bbc/rest-api-example","last_synced_at":"2025-05-14T17:07:55.692Z","repository":{"id":40556516,"uuid":"1406441","full_name":"bbc/REST-API-example","owner":"bbc","description":"Simple REST API example in Sinatra","archived":false,"fork":false,"pushed_at":"2024-11-27T15:13:23.000Z","size":20,"stargazers_count":209,"open_issues_count":2,"forks_count":1310,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-04-15T05:16:29.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-02-24T11:59:20.000Z","updated_at":"2025-03-19T03:01:45.000Z","dependencies_parsed_at":"2024-12-16T06:02:45.059Z","dependency_job_id":"8260247c-361d-46ea-a6e1-a76f070f6f3a","html_url":"https://github.com/bbc/REST-API-example","commit_stats":{"total_commits":7,"total_committers":5,"mean_commits":1.4,"dds":0.7142857142857143,"last_synced_commit":"caf5fb5c52657e62e8ef116490421bc0d2496432"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2FREST-API-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2FREST-API-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2FREST-API-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2FREST-API-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbc","download_url":"https://codeload.github.com/bbc/REST-API-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190396,"owners_count":22029632,"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-11-06T00:26:04.389Z","updated_at":"2025-05-14T17:07:55.667Z","avatar_url":"https://github.com/bbc.png","language":"Ruby","readme":"# REST API example application\n\nThis is a bare-bones example of a Sinatra application providing a REST\nAPI to a DataMapper-backed model.\n\nThe entire application is contained within the `app.rb` file.\n\n`config.ru` is a minimal Rack configuration for unicorn.\n\n`run-tests.sh` runs a simplistic test and generates the API\ndocumentation below.\n\nIt uses `run-curl-tests.rb` which runs each command defined in\n`commands.yml`.\n\n## Install\n\n    bundle install\n\n## Run the app\n\n    unicorn -p 7000\n\n## Run the tests\n\n    ./run-tests.sh\n\n# REST API\n\nThe REST API to the example app is described below.\n\n## Get list of Things\n\n### Request\n\n`GET /thing/`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:30 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 2\n\n    []\n\n## Create a new Thing\n\n### Request\n\n`POST /thing/`\n\n    curl -i -H 'Accept: application/json' -d 'name=Foo\u0026status=new' http://localhost:7000/thing\n\n### Response\n\n    HTTP/1.1 201 Created\n    Date: Thu, 24 Feb 2011 12:36:30 GMT\n    Status: 201 Created\n    Connection: close\n    Content-Type: application/json\n    Location: /thing/1\n    Content-Length: 36\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"new\"}\n\n## Get a specific Thing\n\n### Request\n\n`GET /thing/id`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:30 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 36\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"new\"}\n\n## Get a non-existent Thing\n\n### Request\n\n`GET /thing/id`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/9999\n\n### Response\n\n    HTTP/1.1 404 Not Found\n    Date: Thu, 24 Feb 2011 12:36:30 GMT\n    Status: 404 Not Found\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 35\n\n    {\"status\":404,\"reason\":\"Not found\"}\n\n## Create another new Thing\n\n### Request\n\n`POST /thing/`\n\n    curl -i -H 'Accept: application/json' -d 'name=Bar\u0026junk=rubbish' http://localhost:7000/thing\n\n### Response\n\n    HTTP/1.1 201 Created\n    Date: Thu, 24 Feb 2011 12:36:31 GMT\n    Status: 201 Created\n    Connection: close\n    Content-Type: application/json\n    Location: /thing/2\n    Content-Length: 35\n\n    {\"id\":2,\"name\":\"Bar\",\"status\":null}\n\n## Get list of Things again\n\n### Request\n\n`GET /thing/`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:31 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 74\n\n    [{\"id\":1,\"name\":\"Foo\",\"status\":\"new\"},{\"id\":2,\"name\":\"Bar\",\"status\":null}]\n\n## Change a Thing's state\n\n### Request\n\n`PUT /thing/:id/status/changed`\n\n    curl -i -H 'Accept: application/json' -X PUT http://localhost:7000/thing/1/status/changed\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:31 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 40\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"changed\"}\n\n## Get changed Thing\n\n### Request\n\n`GET /thing/id`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:31 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 40\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"changed\"}\n\n## Change a Thing\n\n### Request\n\n`PUT /thing/:id`\n\n    curl -i -H 'Accept: application/json' -X PUT -d 'name=Foo\u0026status=changed2' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:31 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 41\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"changed2\"}\n\n## Attempt to change a Thing using partial params\n\n### Request\n\n`PUT /thing/:id`\n\n    curl -i -H 'Accept: application/json' -X PUT -d 'status=changed3' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 41\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"changed3\"}\n\n## Attempt to change a Thing using invalid params\n\n### Request\n\n`PUT /thing/:id`\n\n    curl -i -H 'Accept: application/json' -X PUT -d 'id=99\u0026status=changed4' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 41\n\n    {\"id\":1,\"name\":\"Foo\",\"status\":\"changed4\"}\n\n## Change a Thing using the _method hack\n\n### Request\n\n`POST /thing/:id?_method=POST`\n\n    curl -i -H 'Accept: application/json' -X POST -d 'name=Baz\u0026_method=PUT' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 200 OK\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 200 OK\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 41\n\n    {\"id\":1,\"name\":\"Baz\",\"status\":\"changed4\"}\n\n## Change a Thing using the _method hack in the url\n\n### Request\n\n`POST /thing/:id?_method=POST`\n\n    curl -i -H 'Accept: application/json' -X POST -d 'name=Qux' http://localhost:7000/thing/1?_method=PUT\n\n### Response\n\n    HTTP/1.1 404 Not Found\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 404 Not Found\n    Connection: close\n    Content-Type: text/html;charset=utf-8\n    Content-Length: 35\n\n    {\"status\":404,\"reason\":\"Not found\"}\n\n## Delete a Thing\n\n### Request\n\n`DELETE /thing/id`\n\n    curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/\n\n### Response\n\n    HTTP/1.1 204 No Content\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 204 No Content\n    Connection: close\n\n\n## Try to delete same Thing again\n\n### Request\n\n`DELETE /thing/id`\n\n    curl -i -H 'Accept: application/json' -X DELETE http://localhost:7000/thing/1/\n\n### Response\n\n    HTTP/1.1 404 Not Found\n    Date: Thu, 24 Feb 2011 12:36:32 GMT\n    Status: 404 Not Found\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 35\n\n    {\"status\":404,\"reason\":\"Not found\"}\n\n## Get deleted Thing\n\n### Request\n\n`GET /thing/1`\n\n    curl -i -H 'Accept: application/json' http://localhost:7000/thing/1\n\n### Response\n\n    HTTP/1.1 404 Not Found\n    Date: Thu, 24 Feb 2011 12:36:33 GMT\n    Status: 404 Not Found\n    Connection: close\n    Content-Type: application/json\n    Content-Length: 35\n\n    {\"status\":404,\"reason\":\"Not found\"}\n\n## Delete a Thing using the _method hack\n\n### Request\n\n`DELETE /thing/id`\n\n    curl -i -H 'Accept: application/json' -X POST -d'_method=DELETE' http://localhost:7000/thing/2/\n\n### Response\n\n    HTTP/1.1 204 No Content\n    Date: Thu, 24 Feb 2011 12:36:33 GMT\n    Status: 204 No Content\n    Connection: close\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Frest-api-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbc%2Frest-api-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Frest-api-example/lists"}