Help with API shortcut

Hello all, I’m trying to get a shortcut working with an API, having trouble and I’m wondering if anyone here can help. I have a youtube-dl-server docker container running on my server at home. It creates an API endpoint, which can receive a YouTube URL for download via a POST request.

I have this container running behind an NGINX reverse proxy to expose the API to the web, behind basic authentication.

If I run the following from terminal, it works perfectly and downloads the video at {{url_to_download}}:

curl -X POST --user {{username}}:{{password}} --data-urlencode "url={{url_to_download}}" https://ytdl.{{server_url}}.com/youtube-dl/q

But I don’t seem to be able to translate this properly to a shortcut. Would anybody be able to provide some guidance on how I should enter this into the “Get Contents of URL” action? Thanks in advance!

Try setting your credentials as part of the body of a form url encoded post under get url block. Then set the download url up above it as part of a url block. And then quick look the response.

You can try adding content-type/x-www-form-urlencoder as a header as well. You might have to do a header that’s Authorization Basic or Bearer and a token based on the authentication.