We have not been able to upgrade our production installation of because at some point after version 3.6, the API V3 response was taken out of a list.
While the change makes sense (the only ever had one item) it breaks clients that are set up to talk to the old format.
You can see the difference by going to the following two URLs:
Version 3.6: http://pkp-alm.lib.sfu.ca/api/v3/articles/info:doi/10.4081/audiores.2013.e1?api_key=koz58qgTfDhSi89Ekpth
Version 3.21: http://ec2-52-4-177-245.compute-1.amazonaws.com/api/v3/articles/info:doi/10.4081/audiores.2013.e1?api_key=koz58qgTfDhSi89Ekpth
I realize that now it may not be a good idea to change the API response back for others, but we need to patch our production to keep the old response format so that we don't break clients. After a while, once clients upgrade, we can go back to an unpatched install.
Juan, I have kept the v3 API alive up to the current 4.0 release, and I am happy to fix any breaking changes. Some services at PLOS also still use the v3 API.
Is the only difference you see that the response is an object vs. an array? This is confusion, and I have to look into this. Version 4.0 at PLOS serves this: http://alm.plos.org/api/v3/articles/info:doi/10.1371/journal.pmed.1001798
The easiest way to get a response as list/array, is to slightly change the request: http://ec2-52-4-177-245.compute-1.amazonaws.com/api/v3/articles?ids=10.4081/audiores.2013.e1&api_key=koz58qgTfDhSi89Ekpth (the API key is optional here and only needed for private sources).
Would that work?
Yes, the only difference in the response that I've found is the array of objects, versus just the object.
I think the workaround would be fine, as long as I can just put it in a RewriteRule that silently maps the original request to the one you suggest. I'll give this a try soon and report back.
Just realized I can't do a rewrite, as this isn't an Apache server! Is there an equivalent way of doing this in Rails? From what I've looked at, it seems it might be easier to simply change the controller to respond with the array.
Let me look into when this change happened, and how to get back to the old response format. Since PLOS is using the v3 API with the array format, I can add an
When eventually upgrading the API, you should go to v6 that is part of Lagotto 4.0, and skip v5.
@jalperin I have just pushed a fix to the master branch. The Github issue is https://github.com/articlemetrics/lagotto/issues/321.
Please put the following into your
.env file and restart the server:
# return JSON for single works as array in v3 API
And this change happened when switching from
jbuilder for JSON rendering in the API in Lagotto 3.9 in November 2014.