json_rest_api_client 0.1.5 icon indicating copy to clipboard operation
json_rest_api_client: ^0.1.5 copied to clipboard

Easy to use starting point to implement a client library for a json REST API.

Json REST API Client #

Easy null-safe to use starting point to implement a client library for a json REST API.

Usage #

Create your client

  final dummyApiClientV1 =
      JsonRestApiClient(Uri.parse('http://dummy.restapiexample.com/api/v1'));

Perform a GET request with optional query paramters

Let the JsonRestApiClient do the query component encoding.

  final response1 = await dummyApiClientV1.request(
    'GET',
    '/employee/1',
    queryParameters: {'foo': 'bar'}
  );

Perform any other request and send json data

  final response2 = await dummyApiClientV1.request(
    'POST',
    '/create',
    json: {
      'employee_name': 'Tiger Nixon',
      'employee_salary': 320800,
      'employee_age': 61,
    },
  );

You are able to send arrays too

  final response2 = await dummyApiClientV1.request(
    'PATCH',
    '/sendarray',
    json: ['foo', 'bar'],
  );
2
likes
120
pub points
36%
popularity

Publisher

verified publisher iconfamedly.com

Easy to use starting point to implement a client library for a json REST API.

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

http

More

Packages that depend on json_rest_api_client