{"id":15008674,"url":"https://github.com/f3ath/json-api-dart","last_synced_at":"2025-07-19T22:39:09.597Z","repository":{"id":34042074,"uuid":"164269278","full_name":"f3ath/json-api-dart","owner":"f3ath","description":"JSON:API client and server for Dart/Flutter","archived":false,"fork":false,"pushed_at":"2024-09-30T02:49:07.000Z","size":476,"stargazers_count":79,"open_issues_count":4,"forks_count":24,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T19:50:37.458Z","etag":null,"topics":["api","dart","dartlang","flutter","hacktoberfest","helplessness","http","http-client","json","json-api","json-api-client","jsonapi","rest","rest-api"],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/json_api","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/f3ath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"custom":"https://www.paypal.me/f3ath"}},"created_at":"2019-01-06T02:40:20.000Z","updated_at":"2024-08-30T03:34:54.000Z","dependencies_parsed_at":"2023-11-12T05:24:42.378Z","dependency_job_id":"f528ac95-5e1b-408f-ac61-dbe9b664f34b","html_url":"https://github.com/f3ath/json-api-dart","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/f3ath/json-api-dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fjson-api-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fjson-api-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fjson-api-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fjson-api-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f3ath","download_url":"https://codeload.github.com/f3ath/json-api-dart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f3ath%2Fjson-api-dart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262753178,"owners_count":23358884,"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","dart","dartlang","flutter","hacktoberfest","helplessness","http","http-client","json","json-api","json-api-client","jsonapi","rest","rest-api"],"created_at":"2024-09-24T19:19:58.398Z","updated_at":"2025-06-30T10:07:28.984Z","avatar_url":"https://github.com/f3ath.png","language":"Dart","readme":"# JSON:API Client and Server\n\nTL;DR:\n```dart\nimport 'package:http/http.dart' as http;\nimport 'package:http_interop_http/http_interop_http.dart';\nimport 'package:json_api/client.dart';\nimport 'package:json_api/routing.dart';\n\nvoid main() async {\n  /// Define the server's base URL\n  final baseUri = 'http://localhost:8080';\n\n  /// Use the standard recommended URL structure or implement your own\n  final uriDesign = StandardUriDesign(Uri.parse(baseUri));\n\n  /// This is the Dart's standard HTTP client.\n  /// Do not forget to close it in the end.\n  final httpClient = http.Client();\n\n  /// This is the interface which decouples this JSON:API implementation\n  /// from the HTTP client.\n  /// Learn more: https://pub.dev/packages/http_interop\n  final httpHandler = httpClient.handleInterop;\n\n  /// This is the basic JSON:API client. It is flexible but not very convenient\n  /// to use, because you would need to remember a lot of JSON:API protocol details.\n  /// We will use another wrapper on top of it.\n  final jsonApiClient = Client(httpHandler);\n\n  /// The [RoutingClient] is most likely the right choice.\n  /// It is called routing because it routes the calls to the correct\n  /// URLs depending on the use case. Take a look at its methods, they cover\n  /// all the standard scenarios specified by the JSON:API standard.\n  final client = RoutingClient(uriDesign, jsonApiClient);\n\n  try {\n    /// Fetch the collection.\n    /// See other methods to query and manipulate resources.\n    final response = await client.fetchCollection('colors');\n\n    /// The fetched collection allows us to iterate over the resources\n    /// and to look into their attributes\n    for (final resource in response.collection) {\n      final {\n      'name': name,\n      'red': red,\n      'green': green,\n      'blue': blue,\n      } = resource.attributes;\n      print('${resource.type}:${resource.id}');\n      print('$name - $red:$green:$blue');\n    }\n  } on RequestFailure catch (e) {\n    /// Catch error response\n    for (final error in e.errors) {\n      print(error.title);\n    }\n  }\n\n  /// Free up the resources before exit.\n  httpClient.close();\n}\n```\nThis is a work-in-progress. You can help it by submitting a PR with a feature or documentation improvements.\n\n\n[JSON:API]: https://jsonapi.org\n","funding_links":["https://www.paypal.me/f3ath"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Fjson-api-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff3ath%2Fjson-api-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff3ath%2Fjson-api-dart/lists"}