gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 14 forks source link

Replace all usages of curl with GuzzleHTTP in our GigaDB codebase #1750

Open rija opened 6 months ago

rija commented 6 months ago

User story

As a developer
I want to remove usage of PHP curl in the codebase So that all our code that make HTTP connection works the same way And that the amount of code needed to make HTTP connection is drasctically reduced And that we can access features (like client side caching) offered by HTTP libraries that support PSR standards

Acceptance criteria

Given our GigaDB codebase need to talk to a web service
When it is making the HTTP connection
Then the connection is made using the same modern client library (GuzzleHTTP)

Additional Info

This is just for the code we write/maintain. There are some dependencies that currently may need their own specific HTTP client installed (e.g: Unleashed)

This is created out of reviewing PR #1728

Product Backlog Item Ready Checklist

Product Backlog Item Done Checklist

kencho51 commented 6 months ago

We need to evaluate the usage of DataCite REST API.

% curl https://api.test.datacite.org/dois/10.80027/100006 | jq '.[].attributes.url' 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9221    0  9221    0     0   8204      0 --:--:--  0:00:01 --:--:--  8233
"http://gigadb.org/dataset/100006"
rija commented 6 months ago

Hi @kencho51,

That was already suggested in #456

but this issue is independent of what API is used and is not specific to DataCite interactions We just need to get rid of the use of curl in the codebase. I think we have started doing that already, but there is still the code in AdminDatasetController.php. I believe that's the last instance, but we would need to confirm that.

alli83 commented 2 weeks ago

the issue in the current code, is that the errors other than 422 are not being handled. Also why do you need to show the response message received (frontend)?