The API raises a 500 Error: internal server error when a get request is made to counts of platforms with the detailed parameter is set to True: /counts/platforms/v1?detailed=true
How to reproduce it
> curl -X 'GET' 'http://localhost/counts/platforms/v1?detailed=true'
{"detail":"Unexpected exception while processing your request. Please contact the maintainers: type object 'Platform' has no attribute 'platform'"}
Cause
When the detailed parameter set to True the API queries the DB to fetch the number of assets for each platform listed in the DB. Thus, this error occurs because platform has no field platform to be filtered from.
> curl -X 'GET' 'http://localhost/counts/platforms/v1?detailed=true'
{"detail":"Unexpected exception while processing your request. Please contact the maintainers: type object 'Platform' has no attribute 'platform'"}
Suggested solution
Add a condition to return the number of platforms for aiod, in case the platform field is not present in the asset. Ex.:
The API raises a
500 Error: internal server error
when a get request is made to counts of platforms with thedetailed
parameter is set toTrue
:/counts/platforms/v1?detailed=true
How to reproduce it
Cause When the
detailed
parameter set toTrue
the API queries the DB to fetch the number of assets for each platform listed in the DB. Thus, this error occurs becauseplatform
has no fieldplatform
to be filtered from.platforms
, e.g.:datasets
:✅
detailed=false
-> returns a int✅
detailed=true
-> returns a jsonplatforms
✅
detailed=false
-> returns a int❌
detailed=true
Suggested solution Add a condition to return the number of platforms for
aiod
, in case theplatform
field is not present in the asset. Ex.: