This article uses the Data API quick-search request as an example.
curl -X POST "https://api.planet.com/data/v1/quick-search?" -H "Authorization: api-key ...." -H "Content-type: application/json" -H "Accept: application/json" -d '{
"item_types": [
"PSScene"
],
"filter": {
"type": "AndFilter",
"config": [
{
"type": "GeometryFilter",
"field_name": "geometry",
"config": {
"type": "Polygon",
"coordinates": [
[
[
141.7339735551446,
43.27522207886084
],
[
141.73326158304178,
43.2759699862455
],
[
141.73378537391056,
43.27623265962461
],
[
141.7345396473184,
43.27551028801348
],
[
141.7339735551446,
43.27522207886084
]
]
]
}
},
{
"type": "DateRangeFilter",
"field_name": "acquired",
"config": {
"gte": "2021-10-01T00:00:00Z",
"lte": "2022-12-29T15:13:46Z"
}
},
{
"type": "RangeFilter",
"field_name": "cloud_percent",
"config": {
"gte": 0,
"lt": 51
}
},
{
"type": "PermissionFilter",
"config": [
"assets:download"
]
}
]
}
}'
By searching on Planet Explorer with filters, you can click on the API {:} emblem on the bottom left hand side, then click on cURL <> to show the full request in a proper format.
If your request does not have the indentation shown in the payload above, copy and paste the code into the body portion of Postman, and then click on Beautify (on the right hand side underneath "cookies"). Beautify formats the code so that it is easier to read.
Properly formatting your JSON request, and following the standard indentations for the request, can help you avoid many errors in your code.
Comments
Article is closed for comments.