Closed kazlauskis closed 9 months ago
@kazlauskis Is this needed to meet https://github.com/BiologicalRecordsCentre/ABLE/milestone/14? @DavidRoy Shall I take this on?
Yep, exactly.
@JimBacon - yes please
Released in warehouse v8.1.0
@JimBacon thanks!
@Vilius-Stankaitis can you please check this is working in the warehouse1 as expected now?
I followed the pattern already present in the code, to preserve backwards compatibility, which you might not guess from the documentation. Only multi-value attributes return an array. E.g. in abridged form:
"locAttr:306": [
{"multi_value": "t"},
{"multi_value": "t"}
],
"locAttr:330":
{"multi_value": "f"}
@JimBacon thanks again for implementing this. It works fine with one exception. When these is no locations then an Unable to Complete Request page is returned instead of an empty array. It works fine without the verbose flag.
Thanks, @kazlauskis. Fixed in https://github.com/Indicia-Team/warehouse/commit/a4b2d3b1ddc33eb58bafb9400610c059f17dbc7e
From here.
@JimBacon, do you know why this is returning a "Unable to Complete Request" HTML page now? It works fine without the verbose flag.
curl --location 'https://warehouse1.indicia.org.uk/index.php/services/rest/locations?location_type_id=18879&public=false&verbose=1' \ --header 'authorization: Bearer JWT_TOKEN'
The warehouse logs an error:
16:20:27 error #2: Error in Rest API report request. Undefined array key 336821 at line 323 in file /srv/sites/warehouse1.indicia.org.uk/modules/rest_api/helpers/rest_crud.php
16:20:27 debug Stack trace:
/srv/sites/warehouse1.indicia.org.uk/modules/rest_api/helpers/rest_crud.php - line 323 - indicia_error_handler
/srv/sites/warehouse1.indicia.org.uk/modules/rest_api/controllers/services/rest.php - line 3227 - readList
/srv/sites/warehouse1.indicia.org.uk/modules/rest_api/controllers/services/rest.php - line 949 - locationsGet
Unknown file - line Unknown - __call
/srv/sites/warehouse1.indicia.org.uk/system/core/Kohana.php - line 291 - invokeArgs
/srv/sites/warehouse1.indicia.org.uk/system/core/Event.php - line 209 - instance
/srv/sites/warehouse1.indicia.org.uk/system/core/Bootstrap.php - line 55 - run
/srv/sites/warehouse1.indicia.org.uk/index.php - line 112 - require
John modified this code a couple of days ago https://github.com/Indicia-Team/warehouse/commit/8316722ee22d829f5bafa248dbf1b416002e99d1 and I guess he has introduced a bug.
I'll see if I can work out what he was trying to do and whether I can fix it.
I've applied a fix which I hope solves your problem.
What changed is that basic attribute values are now returned by default, without needing the verbose option. Using the verbose option provides more information about the attributes.
Works well, thanks Jim.
The REST docs lists the
verbose
param but it doesn't work with the BRC's warehouse1. We are working on a project that would benefit from this being enabled/fixed.