hasimage not working properly
https://api.harvardartmuseums.org/object&hasimage=1&gallery=1320
then it's returning a lot data but all data don't have image "images": [], "primaryimageurl": null,
that's not what i excepted. How can i handle this problem ?
The hasimages parameter will find objects that have images regardless of the copyright status. We strip out image data if there are copyright issues hence the empty array and null values. You need to add the following parameter: q=imagepermissionlevel:0. This will reduce your data set to objects with images that have no known copyright issues.
See also related comments in https://github.com/harvardartmuseums/api-docs/issues/6#issuecomment-442618209.
I'm hitting this issue every few images even with a query string that contains the params mentioned in the fix threads: imagepermissionlevel=0&hasimage=1.
Ex:
https://api.harvardartmuseums.org/object?page=1571&apikey=[REDACTED]&size=1&hasimage=1&imagepermissionlevel=0&classification=Paintings&people.role=Artist
You must use the q parameter whenever you are querying a field that is not named in the parameter list. In your case change imagepermissionlevel=0&hasimage=1 to q=imagepermissionlevel:0&hasimage=1.
@jeffsteward Great thanks for clarifying! All looks good now 👍
I'm still getting this issue even with the permission level parameter? Would love another set of eyes on it: https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&primaryimageul=true&keyword=sun&q=imagepermissionlevel%3A0&page=2
@heatherca Some of the parameters in your query won't work. primaryimageurl isn't a named parameter. The only way to query fields that are not in [the list of named parameters] (https://github.com/harvardartmuseums/api-docs/blob/master/sections/object.md#get-objects ) is via the q parameter. Here's a reformatted version of your query.
https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&q=imagepermissionlevel:0 AND primaryimageurl:*&person=any&keyword=sun
That being said, I think you found a bug in our query logic. When I run the reformatted query I get more records than expected. I need to investigate further.
That was my bad I was trying to throw more things onto to get it to work. I think the main issue was that q was being overridden by keyword. When I commented out keyword in my call all the results would have the correct imagepermissionlevel:0. I ended up using title instead of keyword which didn't have the same issue.
Would still get imagepermissionlevel not equal to zero: https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&keyword=sun&q=imagepermissionlevel:0
This worked: https://api.harvardartmuseums.org/object?apikey=[mykey]&hasimage=1&sort=random&person=any&title=sun&q=imagepermissionlevel:0
Thanks for the additional info. All signs point to a bad implementation of the keyword parameter. I'm going to log a new issue.