Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for data/v1/item-types/:itemType/items/:itemId/assets return empty response for the item #1

Closed
modulitos opened this issue May 23, 2017 · 1 comment
Assignees

Comments

@modulitos
Copy link

modulitos commented May 23, 2017

This bug is related to the bug I posted here: kscottz/PythonFromSpace#1

I am trying to gather assets for my items, but my queries for assets always return an empty object. Any suggestions on how I can gather these assets?

For example, I can look up an item with the following query: https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/ but I am getting an empty object when I try to get the assets for that item, here:
https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/assets/

Here is a more thorough example:

# Import helper modules:
import os
import json
import requests

# Setup the API Key from the `PL_API_KEY` environment variable
PLANET_API_KEY = os.getenv('PL_API_KEY')
print("PLANET_API_KEY:", PLANET_API_KEY)

# Helper function to printformatted JSON using the json module
def p(data):
    print(json.dumps(data, indent=2))


# Our First Request

# Setup Planet Data API base URL
# url from the example:
# URL = "https://api.planet.com/data/v1"
# url for the 'items' api returns the item in the response:
# URL = "https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044"

# TODO: why does querying for that item's asset give an empty response?
URL = "https://api.planet.com/data/v1/item-types/PSScene3Band/items/20170520_181725_1044/assets/"

# Setup the session
session = requests.Session()

# Authenticate
session.auth = (PLANET_API_KEY, "")

# Make a GET request to the Planet Data API
res = session.get(URL)
print("res.status_code", res.status_code)
print("res.text:", res.text)
print(res.json())
p(res.json())

Perhaps this is a bug in the API, or maybe I am missing something? Any tips would be helpful.

@danabauer
Copy link
Contributor

danabauer commented May 25, 2017

@Lukeswart Your code looks fine. Unfortunately this is a permissions issue. See my response here: kscottz/PythonFromSpace#1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants