INTERACT FORUM
More => Old Versions => JRiver Media Center 31 for Windows => Topic started by: landolfi on January 26, 2024, 12:13:50 pm
-
Any idea why this command:
http://xxx.xxx.x.xxx:52199/MCWS/v1/Playback/StopAll
Only works from a web browser? For example, if I run it using wget it does not work, even if I append a token.
-
Works fine here, what response do you get?
-
Thanks for the quick reply, I'm new to the MCWS REST interface.
It works if I send the server username and password along with the request, so I guess that's the answer. If I send the token with the request it returns an error, and with just the basic command I get a 401.
What threw me off is if I send a stop request to a named zone, it works with a token.
Is the token perpetual or do I have to request a new one from time to time?
-
I think they last a few days of so though I can't remember if that is from last use (ie effectively forever if you keep using it) or not.
-
example that you might be able to try
$ TOK=$(curl -q -u user:pass http://yourhost:yourport/MCWS/v1/Authenticate |xmllint --xpath '/Response/Item[@Name="Token"]/text()' -)
$ curl -v "http://yourhost:yourport/MCWS/v1/Playback/StopAll?Token=${TOK}"
* Host yourhost:yourport was resolved.
* IPv6: (none)
* IPv4: 1.2.3.4
* Trying 1.2.3.4:yourport...
* Connected to yourhost (1.2.3.4) port yourport
> GET /MCWS/v1/Playback/StopAll?Token=mytoken HTTP/1.1
> Host: yourhost:yourport
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/xml;charset=utf-8
< X-JRiver-Library-Server: 1
< Server: Windows, UPnP/1.0 DLNADOC/1.50, JRiver/32, JRiver_Internet_Reader/2.0 (compatible; Windows-Media-Player/10)
< Content-Length: 83
< Date: Fri, 26 Jan 2024 19:12:31 GMT
< X-JRiver-Access-Key: MyKey1
< Cache-Control: no-cache
< Keep-Alive: timeout=10
<
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Response Status="OK"/>
* Connection #0 to host yourhost left intact