[Koha-devel] PUT /holds/:hold_id

dcook at prosentient.com.au dcook at prosentient.com.au
Tue May 18 05:31:03 CEST 2021


I’m not sure that I have much to contribute. 

 

One comment I would have is… what is the threshold for creating a V2 of the REST API? 

 

And maybe a breaking change for the API is OK for a major version change in Koha but just not a minor version change? (That said, I’ve encountered breaking changes in PostgreSQL on minor version updates. They’re annoying, but they are a fact of life I suppose.)

 

David Cook

Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: Koha-devel <koha-devel-bounces at lists.koha-community.org> On Behalf Of Tomas Cohen Arazi
Sent: Tuesday, 18 May 2021 7:05 AM
To: koha-devel <koha-devel at lists.koha-community.org>
Subject: [Koha-devel] PUT /holds/:hold_id

 

Hi all, I wanted to gather some opinions about the mentioned route.

 

We've made sure all routes have the additionalProperties: false setting, and some routes, like this one, don't have it. In the task to add it we noticed:

1. Theroute doesn't work as expected: the documented attributes don't match the coding guidelines (i.e. terminology hasn't been adjusted on the spec) but it did in the code, it just works because we don't set additionalProperties: false. TL;DR no one following the spec can use it.
2. The route seems to be wrong regarding how our RESTful implementation works in the rest of the routes: PUT should get a Koha::Hold object for updating it. Instead, it only 'accepts': 'priority', 'pickup_library_id' and 'suspended_until'. If we wanted to allow to selectively change those attributes, we should do a PATCH instead.
3. We already have individual routes for changing those things on the hold:
PUT /holds/:hold_id/pickup_location
PUT /holds/:hold_id/priority
POST /holds/:hold_id/suspension

The route itself doesn't work now. And any change will break things for people 'using' it. And tests pass only because the spec is loose. The options are:

- 'Fix' the route so the attributes match the code, i.e. change the spec as bug 20006 intended to do.

- Leave it as-is (probably documenting it should not be used).

- Remove the route until we really need to implement that PUT for something.

- Make it a PATCH route, in which we could add new attributes without breaking anyone's dev (besides the verb change, that should be advertised)

- Fully implement a PUT, making it mandatory to send all the attributes (this would be an important breaking change).

 

I would vote removing it, or making it a PATCH route. But I still don't see the use case in the UI, for the latter. Most places in Koha do atomic updates for priority, pickup location or hold suspension for which we clearly have routes already.

 

Looking forward to your comments.

 

-- 

Tomás Cohen Arazi

Theke Solutions (http://theke.io <http://theke.io/> )
✆ +54 9351 3513384
GPG: B2F3C15F

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20210518/17103125/attachment.htm>


More information about the Koha-devel mailing list