In this article, we will use 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 formatting doesn't have the indentations as the above payload. Copy and paste the code into the body portion of Postman, and then click on Beautify (on the right hand side underneath "cookies"). This will beautify your code in one easy click for visualization purposes.
Properly formatting your JSON request, and following the standard indentations for the request, can help you avoid many errors in your code.
Comments
Please sign in to leave a comment.