Help on getting data from http response

Avatar
  • updated
  • Under review

I'm  trying to get data from the respnonse "actualvolume" 

I've been exploring the forum here but i can't figure out what i'm doing wrong.


Parse type: Jhson

I get this response:

{"?xml":{"@version":"1.0","@encoding":"UTF-8"},"volume":{"@deviceID":"C4F312D5994F","targetvolume":"16","actualvolume":"16","muteenabled":"false"}}

Image 2282

Image 2283

Image 2284


Image 2288

Avatar
Jürgen Jürgenson

Try to add a . in front of the command see if it helps like ".volume.actualvolume" Also good sites to check if your command works are https://jsonpath.curiousconcept.com/ or http://jsonpathfinder.com/

Avatar
Dave De Busschere

I just noticed that the Comfortclick, doesn't update the Json response, only the xml

The first line "Response Data" respons the actual volume = 14

the second line "Response Data Xml to Json" keeps the old respons " actual volume =     16????

I made a button and even if I press this it doesn't change.

The add a "." didn't work.

Avatar
Jürgen Jürgenson
Quote from Dave De Busschere

I just noticed that the Comfortclick, doesn't update the Json response, only the xml

The first line "Response Data" respons the actual volume = 14

the second line "Response Data Xml to Json" keeps the old respons " actual volume =     16????

I made a button and even if I press this it doesn't change.

The add a "." didn't work.

It also may be just .actualvolume because you already are sending /volume with the first part of the command. Have you tested it on a web browser, does it change the volume when you paste the command in there?

Avatar
Ricardo Pinto

Can you copy past your Response Data Xml to Json here?

On the Sending menu, change Send Ciclically to true, and on the Cyclical Send Delay use 10s for example, so you can visualize the actual values at least with a 10s interval

Avatar
Dave De Busschere

I get this response:

{"?xml":{"@version":"1.0","@encoding":"UTF-8"},"volume":{"@deviceID":"C4F312D5994F","targetvolume":"16","actualvolume":"16","muteenabled":"false"}}

Avatar
Ricardo Pinto

According to the JSONPath validator / Expression tester, to get the volume the Token Name is:

volume.actualvolume

So your Token is correct.

Probably the data is coming as a String and not as a Double.

Can you test with a String value?

Create two items, CurrentVolume and TargetVolume as Strings. Set the Token names to:

volume.actualvolume and volume.targetvolume

And test it out

Avatar
Dave De Busschere

no result:

tried: volume.actualvolume, .volume.actualvolume, .volume

Avatar
Dave De Busschere

When I look at the Bose website (special-types) it looks like the response is a flag?

sorry for being a amateur, but when I able to retrieve the responsdata and publish it in bos I'm on a go.

https://developer.bose.com/special-types


Avatar
Ricardo Pinto

Hi,

I read the Bose API documentation, and they say that when using GET and POST commands, the data must be formatted in correct XML. So far so good.

But the point here, is that you get the correct response from the unit on the command. But when using the token, it doesn't extract the value. Right now I'm only concerned about the simple GET commands, and as soon as fixed move on to the POST data commands.

If you open the following URL in your browser http://192.168.2.209:8090/volume do you get an answer?

I suppose you get something like:

<?xml version="1.0" ?>
<volume deviceID="$MACADDR">
<targetvolume>$INT</targetvolume>
<actualvolume>$INT</actualvolume>
<muteenabled>$BOOL</muteenabled>
</volume>


Right?

Please copy past your XML answer here. The one you get from the browser, and the one you get on bOS command from "Response Data".

Avatar
Dave De Busschere
Quote from Ricardo Pinto

Hi,

I read the Bose API documentation, and they say that when using GET and POST commands, the data must be formatted in correct XML. So far so good.

But the point here, is that you get the correct response from the unit on the command. But when using the token, it doesn't extract the value. Right now I'm only concerned about the simple GET commands, and as soon as fixed move on to the POST data commands.

If you open the following URL in your browser http://192.168.2.209:8090/volume do you get an answer?

I suppose you get something like:

<?xml version="1.0" ?>
<volume deviceID="$MACADDR">
<targetvolume>$INT</targetvolume>
<actualvolume>$INT</actualvolume>
<muteenabled>$BOOL</muteenabled>
</volume>


Right?

Please copy past your XML answer here. The one you get from the browser, and the one you get on bOS command from "Response Data".

browser answer:

Bos answer: