Hi there! I have a new issue - I’m trying to list all the assets using your API endpoint but it’s constantly returning 401 unauthorized despite having the correct application ID
. Please advise!
Here’s what I have in my python implementation:
@csrf_exempt
def ping_assets(request):
try:
# Retrieve the application ID from AWS Parameter Store
app_id = ‘6678f3678ee68d2b4558d90e’ # Ensure this parameter is correctly set in your store
if not app_id:
raise ValueError(“Application ID not found in AWS Parameter Store”)
url = ‘https://api.readyplayer.me/v1/assets’
headers = {
‘X-APP-ID’: app_id
}
# Log the request details
print(f"Request URL: {url}")
print(f"Request Headers: {headers}")
response = requests.get(url, headers=headers)
print()
# Log the response details
print(f"Response Status Code: {response.status_code}")
print(f"Response Headers: {response.headers}")
print(f"Response Content: {response.text}")
response.raise_for_status()
assets_data = response.json()
return JsonResponse(assets_data, status=status.HTTP_200_OK)
except requests.RequestException as e:
return JsonResponse({‘error’: f’Error fetching assets: {str(e)}'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
except Exception as e:
return JsonResponse({‘error’: f’Unexpected error: {str(e)}'}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)