You should try this request first through an API tool like Postman. It will make troubleshooting much faster. In order to get an API key, you need to create a custom app with the right scopes and get the key: https://help.shopify.com/en/manual/apps/app-types/custom-apps#enable-custom-app-development
For the URL consult the docs I posted earlier.
For the code, please post it as text and not an image.