INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS StopAll only works from browser  (Read 446 times)

landolfi

  • Recent member
  • *
  • Posts: 33
MCWS StopAll only works from browser
« 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.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: MCWS StopAll only works from browser
« Reply #1 on: January 26, 2024, 12:32:03 pm »

Works fine here, what response do you get?
Logged

landolfi

  • Recent member
  • *
  • Posts: 33
Re: MCWS StopAll only works from browser
« Reply #2 on: January 26, 2024, 12:38:35 pm »

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?
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: MCWS StopAll only works from browser
« Reply #3 on: January 26, 2024, 01:07:29 pm »

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.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: MCWS StopAll only works from browser
« Reply #4 on: January 26, 2024, 01:13:49 pm »

example that you might be able to try

Code: [Select]
$ 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
Logged
Pages: [1]   Go Up