Whats the best way to make a HTTP request in a custom task?
v
Vampire
02/02/2022, 6:32 PM
To download a file? Or to trigger some API? Or ...?
j
Jan
02/02/2022, 6:34 PM
trigger some api
v
Vampire
02/02/2022, 7:01 PM
Just use any HTTP client you like.
For simple things even just using
new URL("...").openConnection()
might suffice.
Or if for that API a Java wrapper exists, just use it.
Or if the API provides an OpenAPI specification you can also use a generator to generate code like https://github.com/OpenAPITools/openapi-generator/