api-docs icon indicating copy to clipboard operation
api-docs copied to clipboard

URL Formatting Bug in primaryimageurl

Open QWang00 opened this issue 1 year ago • 1 comments

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!

QWang00 avatar Jan 10 '25 17:01 QWang00

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.

iancallahan avatar Jan 13 '25 19:01 iancallahan