Hi everyone,
An update on this one. I realised there is a constraint to be worked around - the Adlib API returns a json response proper only as raw data from the relevant record, not as data transformed by an XSLT defined in the server. So it is possible to retrieve transformed XML, serialising values from the source dB fields into required structures - and we do lots of that - but the JSON response ignores the XSLT. That makes sense to me actually, possibly to prevent creation of broken JSON in the output. It's probably assumed that a client will retrieve the JSON and transform it programmatically once received.
Anyway, I decided to try this approach:
1. create an XSLT to generate a text output, with well formed JSON, albeit in a text response not a JSON response
2. call that API endpoint from a simple bash script - using curl - to call the API and write the response to a manifest.json in the appropriate path
3. call up once a day for new / changed digital media records, and create / overwrite the manifest.json as required
This seems to work very well and seems robust on a cron.
Next I will add a step to validate the json against the IIIF Presentation Validator (https://github.com/IIIF/presentation-validator / https://iiif.io/api/presentation/validator/service/) before writing it to the manifest.json file.
If anyone is interested in any more detail let me know I can share. But it's all dead simple.
Cheers,
Stephen
****************************************************************
website: http://museumscomputergroup.org.uk/
Twitter: http://www.twitter.com/ukmcg
Facebook: http://www.facebook.com/museumscomputergroup
[un]subscribe: http://museumscomputergroup.org.uk/email-list/
****************************************************************
|