I’m trying to use the API in PowerShell, but I don’t understand how to pass the audio file to the WebRequest. I have tried passing the filename and I have tried imbedding the raw MP3 in the body, but i always get “could not be determined”. But if I use the same MP3 file from the RapidAPI playground Test Endpoint it works.
This is my code:
headers.Add(“content-type”, “multipart/form-data; boundary=—011000010111000001101001”)
headers.Add(“X-RapidAPI-Host”, “shazam-api-free.p.rapidapi.com”)
$response = Invoke-WebRequest -Uri ‘https://shazam-api-free.p.rapidapi.com/shazam/recognize/’ -Method POST -Headers $headers -ContentType ‘multipart/form-data; boundary=—011000010111000001101001’ -Body '-----011000010111000001101001
Content-Disposition: form-data; name=“upload_file”; filename=“1-05 Wild Honey Pie.mp3” Content-Type: audio/mpeg
-----011000010111000001101001–
’
Aşağıya yorum ekleyerek tartışmaya katılın:
binary
Unfortunately I’m not making any progress. I have tried uploading the file as a binary MP3, and I have tried encoding it as Base64. What format are you expecting the file?
it is possible
I’ve tried with multiple MP3 files. I think I am doing something wrong in the construction of the WebRequest.
have you tried with another mp3?