Adding pick list (aka reference data) values via the API

It may sometimes be useful to add multiple pick list values in a batch - especially for lists that are likely to have many entries such as Publishers and Licenses. In the first release of the Open Access requests app there is no way to do this via the UI (values can only be added one at a time in Settings), but it is possible to do so via the API. To do this you need to retrieve the UUID for the relevant refdata category (each category UUID refers to a specific pick list), and then PUT an array of values to the OKAPI refdata endpoint for OA as follows

method: PUT
OKAPI endpoint: /oa/refdata/<categoryUUID>
Data format:
{
  "values": [
      "label": "pick list value 1",
      "label": "pick list value 2",
      "label": "pick list value 3",
      etc.
   ]
}

The list of category UUIDs  can be obtained by GET call to the same endpoint:

method: GET
OKAPI endpoint: /oa/refdata/
Optional parameters that can be appended to endpoint:
* max=<integer> ← maximum number of refdata categories to include in the response
* offset=<integer> ← in the case of paging through a list of refdata categories (i.e. if max is lower than the total number of categories), where to retrieve the next page of results from
* stats=<boolean> ← to include in the response the total number of results available

In the JSON response the "description" field will contain the label for the pick list / category as displayed in the Settings UI. For example:

  • PublicationRequest.Publisher = publisher pick list