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
Ricardo Pinto

Can you do a little test?

Create 2x Double values:

Name: Target Volume double

Token name: targetvolume

Name: Actual Volume double

Token name: actualvolume

Create 2x String values:

Name: Target Volume string

Token name: targetvolume

Name: Actual Volume string

Token name: actualvolume

I tested the response on several online converters / parsers, and I believe that:

If we keep the <?xml version...?> part, the correct token name should be volume.targetvolume and volume.actualvolume

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

But if you remove the <?xml version...?>, the correct token name is actually only targetvolume and actualvolume, just the text, with no "." after or before.

{
   "deviceID": "C4F312D5994F",
   "targetvolume": "10",
   "actualvolume": "10",
   "muteenabled": "false"
}

Can you test the token names only with targetvolume and actualvolume without any dots?

The double and strings values, are just to test the correct format. I supposed that the values from volume are coming as double values, but you can test both

Avatar
Ricardo Pinto

Ah BTW, can you change the parser type to XML on the device?

And post again the responses?

Avatar
Dave De Busschere
Quote from Ricardo Pinto

Ah BTW, can you change the parser type to XML on the device?

And post again the responses?


Avatar
Ricardo Pinto

And if you change back the parser to Json? The values show empty again?

Avatar
Dave De Busschere
Quote from Ricardo Pinto

And if you change back the parser to Json? The values show empty again?

Nothing changes

I turned the volume with the Bose remote up to 12, when I push the button in Bos Theme "Get current volume" the response data changes to 12 BUT the response Data Xml to Json remains on the 10!!!

I Get a reading (communication between the Bose and Bos). 


Avatar
Ricardo Pinto

Can it be a bOS bug?

First: It doesn't make sense that the Response Data updates, and the Response Data Xml to Json doesn't... as it's supposed to be updated according to the Response Data received...everytime the Response Data changes, the Xml to Json is supposed to change also.

Second: It doesn't make sense the Tokens don't extract anything, because if we check the Json response in any online expression tester, the values are correct:

Using JSONPath Expression Tester web service (https://jsonpath.curiousconcept.com/), which is the one I use all the time to test the expressions before getting them on bOS, if you past the following expression:

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

And place volume.actualvolume on the Expression, you get this as an answer:

[ 
"16"
]

BUT, only by using the called JSONPath 0.2.5 or above... below that implementation, the response is empty.

bOS team, can you help us out here?

Avatar
ComfortClick Support

Hello,


Seems you were using wrong token name, you should be using XML parser and token name should be volume.actualvolume. Did you try this as well?


Best regards.

Avatar
Dave De Busschere

Hi there,


It looks like that was the issue ;-)

Got response !!!!!!! :-))))))))))


Now we can start to make the Bose audio integration.

Keep you guys posted on the result.


Thaaaaaaaaanks, 

Avatar
Dave De Busschere

1.) Is there a way, to have Bos check the value instantly? I have activated the send cyclically but the value's don't change.

I put the volume to 10 but it stays on 14 until I push the button to send the command.

2.) Can I use a slider to change the volume? I have to integrate the slider value in a post <volume>value</volume>

Avatar
Ricardo Pinto
Quote from ComfortClick Support

Hello,


Seems you were using wrong token name, you should be using XML parser and token name should be volume.actualvolume. Did you try this as well?


Best regards.

Ahhh almost there...

We've tested with the correct token on previous tests, but not with xml as parser.

Thanks for the help