...
In your computer, open the terminal then type in: curl -H 'Authorization: apikey-v1 X-Api-Key: <apikey>' https://ecoimages.tern.org.au/api/whoami (e.g. curl -H 'Authorization: apikey-v1 X-Api-Key: fakebmRSFNPXSF5aiI7OjpUM1s6eiANQmgyKF8NJjRpZFJqSGMlPWlRVQlGKndoUzI4JXhkVSY/b2IL' https://ecoimages.tern.org.au/api/whoami
The output should be similar to what is shown in figure 7:
...
Code Block | ||||
---|---|---|---|---|
| ||||
import requests API_KEY = "apikey-v1 fakeRnZRTC5Nfk8/bjk1SSFNPXp5KSFF8NJjRpZFJqSGMlPWlRVQlGKndoUzI4JXhkVSY/b2IL" URI = "https://ecoimages.tern.org.au/api/whoami" headers = { "AuthorizationX-Api-Key": API_KEY } result = requests.get(URI, headers=headers) print(result.json()) ####Results##### {'email': 'user@adelaide.edu.au', 'email_verified': True, 'family_name': 'FamilyName', 'given_name': 'User', 'id': '97e6e762-257f-4e31-8cb4-9a30d578194b', 'name': 'UserName', 'roles': ['admin'], 'scopes': ['email', 'profile']} |
...
Code Block | ||||
---|---|---|---|---|
| ||||
import requests API_KEY = "apikey-v1 fakeTUd5QnpwRnZRTC5Nfk8/bjk1SSFNJjRpZFJqSGMlPWlRVQlGKndoUzI4JXhkVSY/b2IL" URI = "https://ecoimages.tern.org.au/api/v1.0/packages?page_size=1&page_num=1" headers = { "AuthorizationX-Api-Key": API_KEY } result = requests.get(URI, headers=headers) print(result.json()) ###Results###### {"current_count": 1, "packages": [ {"can_download": True, "can_mint_package": True, "can_request_download": False, "can_update_package": True, "description": "Dete again", "doi": "", "doi_requested": False, "download_file_format": "zip", "eta": -1, "expiration_date": "2022-01-26", "is_my_package": True, "online_status": "In Progress", "package_id": "41e3ef57532011ecb2aae22c8c1c3fad", "package_location": "/api/v1.0/packages/41e3ef57532011ecb2aae22c8c1c3fad", "package_status": "Complete", "progress": 100, "query": {"from": 0, "image_type": ["ancillary.general"], "page_num": 1, "page_size": 8000}, "request_date": "2021-12-02", "title": "Test again delete initialized", "zip_progress": 100, "zip_status": "Complete" } ], "total_packages": 18 } |
...