Endpoint - https://data.geoiq.io/dataapis/v1.0/covid/locationcheck
{ "key": string, "latlngs": array }
[enter image description here][1]
How To Fetch Data From API With This Format In Flutter [1]: https://i.stack.imgur.com/V6hVH.png
Endpoint - https://data.geoiq.io/dataapis/v1.0/covid/locationcheck
{ "key": string, "latlngs": array }
[enter image description here][1]
How To Fetch Data From API With This Format In Flutter [1]: https://i.stack.imgur.com/V6hVH.png
Basically your API endpoint is asking for body.
In flutter, you can use package http: ^0.12.1
import 'package:http/http.dart' as http;
final api = 'https://data.geoiq.io/dataapis/v1.0/covid/locationcheck';
final response = http.post(api, body: { "key": string, "latlngs": array });
And if API endpoint requires an Authentication token. For example Bearer token then you can use
final token = 'YOUR TOKEN';
final response = http.post(api, body: { "key": string, "latlngs": array }, headers: {
'Authorization': 'Bearer $token',
});
Please find below a sample request.
import json as js
import requests
body = {"latlngs": [
[
12.967444,
77.498775
],
[
14.656773,
77.627936
],
[
19.200027,
72.970519
],
[
12.962882,
77.543543
]],
"key": "Auth Key"}
headers = {'Content-Type': 'application/json'}
r = requests.post(url = "https://data.geoiq.io/dataapis/v1.0/covid/locationcheck", data = js.dumps(body), headers = headers)