Trouble using EXEC_SEND_HTTP_POST with credentials

You have a question or need an advice about how to do something? Ask it here!
Post Reply
fred48fm
Posts: 73
Joined: 28 Aug 2019 09:52
Trouble using EXEC_SEND_HTTP_POST with credentials

Post by fred48fm »

Hi,

I can't find a way to use EXEC_SEND_HTTP_POST correctly ...
It works without credentials, but when I add credentials, i got "Error : HTTP web request failed"

I tryed like this :

EXEC_SEND_HTTP_POST user|password|http://server.com/myuri|var=value&var2=value2

If anyone got an idea ?

Thank a lot :-)
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by radio42 »

If it works without credentials, it indicates, that your server doesn't support them. So why do you add them then?
E.g. you only need credentials, if your server requires them, e.g. in a SSL/TLS environment when using https://...!
Another option when such an error occurs is, that the credentials are invalid.
fred48fm
Posts: 73
Joined: 28 Aug 2019 09:52
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by fred48fm »

We used this server and credentials on our previous system without problem.
When I say, "it work without credentials" it's just that i got a response from server (requesting me for login/password).

Strange...
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by radio42 »

What are the exact specifications of your server or API?

EXEC_SEND_HTTP_POST uses the content type "application/x-www-form-urlencoded" and provides the username:password as 'Basic' encoding in the header of the web requet (pre-authentication) and supports TLS1.1, 1.2 and 1.3.

EXEC_SEND_HTTPPOSTPLAIN doesn't provide and special content type and posts the content as plain text.

Maybe also need to use EXEC_SEND_HTTP_GET which uses a simple web request?
fred48fm
Posts: 73
Joined: 28 Aug 2019 09:52
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by fred48fm »

No idea, it's not in the system doc...
Just this :

API Usage
In order to use the API you will need an HTTP client that is capable of HTTPS communication,
pre-emptive authentication, setting request headers, reading response status codes and reading
the response body.

https
The API requires the use of simple HTTPS in all communication.

For information, the server doc says this when using curl :
curl -u yourusername:yourpassword -v --data "rpId=YOUR_RPID&startTime=2013-10-01T08:27:00&duration=600&title=SONG TITLE&artist=ARTIST" -X POST "https://___________"

For the time (will look further in this another time), I use a php script between proppfrexx and the server. EXEC_SEND_HTTP_POST send the data with no authentification to the php script. The script take the same data and send it to the API.

Thanks
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by radio42 »

That sounds like the API from radioplayer.org.

I just had a test with them (Anna Pettersen) and its is working fine.
Unfortunately their https URL as given in docs was incorrect - so after providing the correct one all was working well.

Here is the command we used with the 'Streaming.OnSongTitleChanged' event:

Code: Select all

EXEC_SEND_HTTP_POST username|password|https://ingest.mereradio.dk/ingestor/metadata/v1/np/|rpId=yourid&*[DATE:{${now}}:{utc}:{0}:{o}]&duration=${playtimesec}&title=${title}&artist=${title}
Note: Make sure to use the latest v4.1.3.1 of ProppFrexx.
fred48fm
Posts: 73
Joined: 28 Aug 2019 09:52
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by fred48fm »

Perfect !
That's exactly the piece of script I was looking for :-)

Thank you !
fred48fm
Posts: 73
Joined: 28 Aug 2019 09:52
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by fred48fm »

After few tries, the working command for Radioplayer API is (in our case) :

EXEC_SEND_HTTP_POST user|password|https://ingest.__________/ingestor/metadata/v1/np/|rpId=_____&startTime=*[STRING:{*<DATE:{${now}}:{utc}:{0}:{o}>}:{rpad}:{19}]&duration=*[TOINT:{${cpltimeremain}}:{round}]&title=${cpltracktitlecurrent}&artist=${cpltrackartistcurrent}&imageUrl=https://___________/cover_${VAR:time}.jpg

Thank you for your help !
RadioMaxDK
Posts: 30
Joined: 10 Feb 2017 14:20
Re: Trouble using EXEC_SEND_HTTP_POST with credentials

Post by RadioMaxDK »

Thanks to Bernd, this worked for my setup:

EXEC_SEND_HTTP_POST User|Password|https://ingest.mereradio.dk/ingestor/metadata/v1/np/|rpId=1234&startTime=*[STRING:{*<DATE:{${now}}:{utc}:{0}:{o}>}:{rpad}:{19}]&duration=*[TOINT:{${playtimesec}}:{round}:{0.5}]&title=${title}&artist=${artist}

Post Reply