rucio icon indicating copy to clipboard operation
rucio copied to clipboard

Rest Api ListReplicas endpoint should be GET

Open joeldierkes opened this issue 3 years ago • 3 comments

Motivation

The Rest Api ListReplicas endpoint should be a GET request, it is a POST. https://github.com/rucio/rucio/blob/2e3ad40fc1e64abb35e1e4e4bd5cddec9701d3f9/lib/rucio/web/rest/flaskapi/v1/replicas.py#L299

Modification

Change the ListReplicas endpoint request type.

joeldierkes avatar May 02 '22 12:05 joeldierkes

Careful with this.

We have two different types of clients right now, one expects the POST to come back as application/x-json-stream (one full json per entry per line returned), the one that expects GET to come back as application/x-json (one full json reply containing everything).

Adding @davidgcameron for info (since ARC is using the GET case)

mlassnig avatar May 02 '22 12:05 mlassnig

Yes, some explanation would be nice. Specifically:

  • The GET method in HTTP is used to request data, the POST is used to create/update data. In the ListReplicas endpoint, the data is only requested, not updated/posted. Why don't we have two separate endpoints or a header variable to distinguish that instead of the POST request? We're already doing that for the metalink case:https://github.com/rucio/rucio/blob/2e3ad40fc1e64abb35e1e4e4bd5cddec9701d3f9/lib/rucio/web/rest/flaskapi/v1/replicas.py#L376
  • The GET method is not implemented for the replica/list endpoint, where is it coming from? https://github.com/rucio/rucio/blob/2e3ad40fc1e64abb35e1e4e4bd5cddec9701d3f9/lib/rucio/web/rest/flaskapi/v1/replicas.py#L890

joeldierkes avatar May 02 '22 12:05 joeldierkes

The issue here is historic. POST was chosen (instead of GET) due to the header-size limitations of a get. Thus much less replicas could be asked for in a list_replicas. However, this could probably have been solved differently by addressing these limits in apache (I believe there is a setting for that)

To move forward:

  • Investigate the setting in apache
  • Duplicate this endpoint as a GET endpoint (Leave the POST as it is)
  • Over time we might be able to deprecate the POST endpoint

bari12 avatar May 05 '22 09:05 bari12