I generated a nextcloud app using the app generator and I have created one route and a controller in the app. I need to make a call to external website from the controller action. I tried using ICloud interface (like use OCP\Http\Client\IClient;
) for that but got this error "message":{"Exception":"OCP\\AppFramework\\QueryException","Message":"Could not resolve client! Class client does not exist","Code":0
. I am running the nextcloud server through docker image and the nextcloud version is 20.0.6. Can anyone help me out with this, please?
Hi,
sounds like you tried to have an IClient
injected directly. You have to have \OCP\Http\Client\IClientService
injected instead and call newClient()
on that service to get an instance of a HTTP client.
As I wanted to report a missing documentation page I found my own ticket from last year HTTP client docs · Issue #2196 · nextcloud/documentation · GitHub. Sorry, this should be documented but nobody had time for it yet.