[Koha-bugs] [Bug 26635] Expand coded values in REST API call

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Oct 29 14:28:33 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26635

--- Comment #61 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
So.. for my own sanity.. the final structure is this right:

GET /api/v1/items/1

{
    "_authorized_values": {
        "location": {
            "category": "LOC",
            "description": "General Stacks",
        }
    },
    "acquisition_date": "2014-05-07",
    "acquisition_source": null,
    "biblio_id": 1,
    "item_id": 1,
    ...
    "location": "GEN",
    ...
    "uri": null,
    "withdrawn": 0,
    "withdrawn_date": null
}

GET /api/v1/items

[
  {
    "_authorized_values": {
        "location": {
            "category": "LOC",
            "description": "General Stacks",
        }
    },
    "acquisition_date": "2014-05-07",
    "acquisition_source": null,
    "biblio_id": 1,
    "item_id": 1,
    ...
    "location": "GEN",
    ...
    "uri": null,
    "withdrawn": 0,
    "withdrawn_date": null
  },
  {
    "_authorized_values": {
        "location": {
            "category": "LOC",
            "description": "Birchwood Shelves",
        }
    },
    "acquisition_date": "2017-02-14",
    "acquisition_source": null,
    "biblio_id": 2,
    "item_id": 12,
    ...
    "location": "BIR",
    ...
    "uri": null,
    "withdrawn": 0,
    "withdrawn_date": null
  }
]

So.. an embedded _authorized_values structure per individual object (not at a
top level.. as we can't do that for things like biblios where the framework
governs stuff..)

We keep the lookup as '_authorized' so we know it's an authorized value (not
another coded lookup).. and we include 'category' so we can know the link
between the field and which av category we're looking at (for later lookups
should we want to produce a pick list).. and then we have the interface
specific return for description.

I'm no against also including image url if we think that's helpful.. I could
see if being so.. but it also feels fairly specific to only a minority of AV
cases.. so maybe not too..

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list