2021年5月2日星期日

Curl Post method Sentinel API on Flutter

I need to extract the dates through the Sentinel server. On the Sentinel page there is an example using Curl but I'm having problems: Http Status 500 Internal Server Error and I don't know how to solve it and i tried to find some solution without success. I already have the token and the problem is not authentication. Here is the sample code for sentinel:

Sentinel link: https://www.sentinel-hub.com/faq/where-can-i-get-list-available-dates-imagery-specific-area/

curl -X POST 'services.sentinel-hub.com/api/v1/catalog/search' \  -header 'Authorization: Bearer <your access token>' \  -header 'Content-Type: application/json' \  -data-raw '{      "bbox": [13,45,14,46],      "datetime": "2019-12-10T00:00:00Z/2020-12-15T00:00:00Z",      "collections": ["sentinel-1-grd"],      "limit": 50,      "distinct": "date"  }'  

And here is the Dart code:

 var url = 'http://services.sentinel-hub.com/api/v1/catalog/search';      Map<String, dynamic> body = {        "bbox": "[13, 45, 14, 46]",        "datetime": "2019-12-10T00:00:00Z/2020-12-15T00:00:00Z",        "collections": ["sentinel-2-l2a"],        "limit": 50,        "distinct": "date"      };        var response = await http.post(        url,        headers: {          'Authorization': 'Bearer <your access token>',          'Content-Type': 'application/json',        },        body: json.encode(body),      );  

Thanks in advance :)

https://stackoverflow.com/questions/67363354/curl-post-method-sentinel-api-on-flutter May 03, 2021 at 12:07PM

没有评论:

发表评论