Format for HTTP REST GET commands
Posted: Fri Sep 13, 2019 6:22 am
I'm using REST commands to control my SONOS system via the SONOS HTTP API (https://github.com/jishi/node-sonos-http-api). I utilize feedback from the SONOS system to populate a list of Favorite Stations. I then create commands that send a request to play one of the stations.
My problem is that using DemoPad to send the GET commands requires the command be formatted like this:
GET /RoomName/favorite/Station%20XYZ HTTP/1.0\x0D\x0A
vs
GET /RoomName/favorite/Station XYZ HTTP/1.0\x0D\x0A
When I test using Postman the %20 is not required. The problem is that I want to dynamically insert the Favorite Station name based on feedback I receive from SONOS that tells me what the favorite stations are. And the feedback has a space instead of %20.
It looks something like this:
LABELS Created from Feedback
Favorite 1 = Station XYZ
Favorite 2 = Station ABC
Favorite 3 = Station 3
Commands
Play Favorite 1 = GET /RoomName/favorite/[Favorite 1] HTTP/1.0\x0D\x0A
However the Play Favorite command does not work because it trys to send a command with a space between "Station" and "XYZ" instead of a "%20".
Does anyone know of a solution? A way to get DemoPad to format the message in a way that does not require the %20 to be manually added? or a way to add the %20 into the variable "Favorite 1"?
My problem is that using DemoPad to send the GET commands requires the command be formatted like this:
GET /RoomName/favorite/Station%20XYZ HTTP/1.0\x0D\x0A
vs
GET /RoomName/favorite/Station XYZ HTTP/1.0\x0D\x0A
When I test using Postman the %20 is not required. The problem is that I want to dynamically insert the Favorite Station name based on feedback I receive from SONOS that tells me what the favorite stations are. And the feedback has a space instead of %20.
It looks something like this:
LABELS Created from Feedback
Favorite 1 = Station XYZ
Favorite 2 = Station ABC
Favorite 3 = Station 3
Commands
Play Favorite 1 = GET /RoomName/favorite/[Favorite 1] HTTP/1.0\x0D\x0A
However the Play Favorite command does not work because it trys to send a command with a space between "Station" and "XYZ" instead of a "%20".
Does anyone know of a solution? A way to get DemoPad to format the message in a way that does not require the %20 to be manually added? or a way to add the %20 into the variable "Favorite 1"?