Solved

Assets link returning empty content? Data API

  • 7 October 2022
  • 3 replies
  • 65 views

Userlevel 1
Badge +1

I’m trying to list an item’s assets (see https://developers.planet.com/docs/apis/data/reference/#tag/Items-and-Assets/operation/ListItemAssets), but the response is empty for some reason.

 

For example, if I send a get request to https://api.planet.com/data/v1/item-types/PSScene/items/20220101_224552_0f21/assets/ (with my API key), I get a 200 response code but the data is just empty brackets. Can anyone tell me what I’m doing wrong?

icon

Best answer by cholmes 7 October 2022, 18:41

View original

3 replies

Userlevel 4
Badge +3

Hey @james.mason! Welcome to Planet Community, and thanks for posting. 

Do you have download permissions for that item? If you go to https://api.planet.com/data/v1/item-types/PSScene/items/20220101_224552_0f21/ do you see something like: 

"_permissions": [
"assets.basic_udm2:download",
"assets.ortho_analytic_3b:download",
"assets.ortho_analytic_3b_xml:download",
"assets.ortho_udm2:download",
"assets.ortho_visual:download",
"assets.ps3b_udm:download",
"assets.ps3b_visual_xml:download"
],
"assets": [
"basic_udm2",
"ortho_analytic_3b",
"ortho_analytic_3b_xml",
"ortho_udm2",
"ortho_visual",
"ps3b_udm",
"ps3b_visual_xml"
],

 Or are permissions and assets blank? 

 

Userlevel 4
Badge +3

Just checked behavior when you don’t have permissions, and got the same empty brackets response with you. In the item JSON I see an array with the assets listed, but the permissions is empty.

To get an item that you have download permissions for you can use Planet Explorer, and its default searches are just for items you have download permission.

You can also use Planet’s Python SDK/CLI and be sure to use the permissions filter https://planet-sdk-for-python-v2.readthedocs.io/en/latest/api/#planet.data_filter.permission_filter

Or the command-line interface can be easier to use, and its default search uses the permission filter. You’d just say:

planet data filter | planet data search PSScene

and then all the data you get back should be ones you have download access to.

Userlevel 1
Badge +1

Ah you are right, I am missing permissions for the item.

Thanks for the info on permissions filtering! And I wasn’t aware of the new Python SDK -- I might try it out.

Reply