fetch API in JavaScript.
Recommendations
- Avoid storing API key in your code, use environment variables instead (
process.env). - More parameters can be added to the request, see the API reference for more information.
- Prefer
async/awaitoverthen/catchfor better readability. - You might be interested in OpenAPI Generator to generate client libraries for your favorite programming language, it might help you to interact with the API in a more convenient way.
