URL Formatting Bug in primaryimageurl
Problem
When I use the API to get the primaryimageurl (e.g., https://api.harvardartmuseums.org/object/304069/primaryimageurl?apikey=YOUR_API_KEY), the URL in the response has an extra space after : and before //.
Example response:
"primaryimageurl": "https: //nrs.harvard.edu/urn-3:HUAM:DDC251092_dynmc"
This makes the URL invalid and unusable in browsers or apps.
Expected
The URL should look like this:
"primaryimageurl": "https://nrs.harvard.edu/urn-3:HUAM:DDC251092_dynmc"
Request
It would be greatly appreciated if the extra space could be removed to ensure the URL functions correctly.
Thank you!
Hello, Thanks for reporting this. The API was designed with that field parameter as a shortcut for getting arrays out of a record. In this case, the primaryimageurl value is just a string so it is returning as plain text. It still has an 'application/json' content-type header. If you are parsing this response as JSON, it will treat the URL as a key/value pair: "https" : "//nrs.harvard.edu...". For now, you should either parse the response as plain text or fetch the entire record and use the primaryimageurl value from there.