[FOLIO-3861] OkapiCLI.py doesn't support DELETE request with body Created: 24/Jul/23  Updated: 10/Aug/23  Resolved: 10/Aug/23

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Bug Priority: TBD
Reporter: T. Mellman Assignee: Florian Gleixner
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: File ApiClient.py     File OkapiCLI.py    
Sprint:
Development Team: Other dev
Release: Not For Release
Potential Workaround: https://folio-project.slack.com/archives/CQ7EK52LB/p1688136545312619
Analysis Estimate: Very Small (VS) < 1day
Analysis Estimator: Florian Gleixner
Affected releases:
Nolana (R3 2022)

 Description   

Overview:

OkapiCLI.py doesn't support DELETE request with body

Steps to Reproduce:

Install OkapiCLI.py from https://gitlab.lrz.de/bib-public/okapiclient

python3 /home/mellman/w/gitlab/okapiclient/OkapiCLI.py --url https://tum2-nolana.folio.bib-bvb.de/okapi --username admin --password password --tenant tum2 --insecure --verbose raw --rawpath 'inventory-upsert-hrid' --method delete   hrid-deletion.json

Expected Results:

instance has been deleted

Actual Results:

  • with the "hrid-deletion.json", than  some kind of unexpected parameter message.
  • without that filename specification, then an empty-body error

Additional Information:
URL: https://gitlab.lrz.de/bib-public/okapiclient

Some DELETE APIs require a body: https://s3.amazonaws.com/foliodocs/api/mod-inventory-update/r/inventory-update.html#inventory_upsert_hrid_delete

OkapiCLI.py's mechanism, whether to expect a body on stdin, doesn't work in general, some other way should be considered, see wget --post-data, wget --post-file, curl --data, curl --data-raw, curl --data-binary

Interested parties:

Julian Ladisch



 Comments   
Comment by T. Mellman [ 24/Jul/23 ]

https://folio-project.slack.com/archives/CQ7EK52LB/p1688136545312619

Comment by T. Mellman [ 24/Jul/23 ]

monospaced text
==== /h/tmp/mBv78i_OkapiCLI.py OkapiCLI.py ====
71a72,73
> rawParser.add_argument('data', default = None, nargs = "?")
>
115,117c117,123
< if args.method in ['post', 'put', 'delete']:
< input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
< data = input_stream.read()

> if args.method in ['post', 'put'] or args.method == 'delete' and args.rawpath in client.delete_with_payload:
> if args.data:
> data = open (args.data, "r", encoding = "utf-8").read()
> else:
> input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
> data = input_stream.read()
>
==== /h/tmp/07HOfk_ApiClient.py src/OkapiAPIClient/ApiClient.py ====
70a71
> delete_with_payload = [ "inventory-upsert-hrid" ]
192c193,196
< response = requests.delete(url=url, headers=headers, verify=verify)

> if data:
> response = requests.delete(url=url, headers=headers, verify=verify, data = data)
> else:
> response = requests.delete(url=url, headers=headers, verify=verify)

Comment by Ann-Marie Breaux (Inactive) [ 26/Jul/23 ]

T. Mellman and Florian Gleixner Hi! There's no summary (title) for this bug and no description. It's also not assigned to a development team. Could those fields be updated? Thank you!

Comment by T. Mellman [ 27/Jul/23 ]

Where do I put the summary?

Julian Ladisch recommended that I assign it to Florian Gleixner.  Is that the developement team that you mean?  How do I find his development team, and where do I put it?

Comment by Ann-Marie Breaux (Inactive) [ 27/Jul/23 ]

Hi there! The Summary is the title of the Jira (which currently reads "Standard Bug Write-up Format" - just click in that area at the top of the Jira, and it wil turn into an editable field. Then just assign that default text to a more descriptive title for the Jira.

I'm not sure if Florian Gleixner is a member of one of the dev teams or not. For now, I'll just assign the team as "Other dev," and someone can reassign if it should go to a more specific team. Thank you!

Comment by T. Mellman [ 27/Jul/23 ]

Thank you for your support.

When I click on "Standard Bug Write-up Format", I get what looks like the full description dialog, but it says I don't have permissions to modify the template.  Before I can even try, the screen goes dark and I'm ushered into some tunnel about system and user variables.  I'm lost.

Thank you for managing the dev teams for me.

Comment by Florian Gleixner [ 27/Jul/23 ]

Can you check the latest version / commit from yesterday? Does it solve the problems?

Comment by Julian Ladisch [ 27/Jul/23 ]

The help section neither shows --data nor --file: https://gitlab.lrz.de/bib-public/okapiclient#help

Comment by Florian Gleixner [ 10/Aug/23 ]

It is only avalible in the raw module, and help for the raw module can be shown using:

./OkapiCLI.py raw --help
Comment by Florian Gleixner [ 10/Aug/23 ]

Fixed in 0.0.5

Generated at Thu Feb 08 23:31:20 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.