News:

There is a soft-mute function which we use with the commands like "What song is this?" There is one for system volume, one for each of: MediaMonkey, XBMC, iTunes, MediaPortal.

Main Menu

translating cURL to Scrape

Started by Haddood, January 04, 2016, 05:24:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Haddood

I am working on integrating DashingIO with VC ... to update the widgets with new info they posted example of cURL ... and it look like this (for windows):
curl -X POST  -H "Content-Type: application/json" -d "{ \"auth_token\": \"pass\", \"text\": \"Off\" }" http://localhost:3030/widgets/VoxCommando

i am trying to use scrape post, but I keep getting error:
JSON:: ParserError - 757: unexpected token at ' 'auth_token' : 'pass', 'text': 'Off' '
when I am using a command like the one below... I tried double qoutes ... with slashes and without ... non is working  :bonk :bonk

anyhelp appreciated


<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.4-->
<command id="878" name="Send Status to Dashing" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape.Post</cmdType>
    <params>
      <param>http://localhost:3030/widgets/VoxCommando</param>
      <param> 'auth_token': 'pass', 'text': 'Off'</param>
      <param />
      <param />
      <param>application/json</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>
When Voice command gets tough, use hand gestures

nime5ter

#1
Sorry, but are you replacing 'pass' with your password? Seems like it might be expecting a password there?

That would explain the unexpected token.

But if it's working for you using cURL, then:

Have you tried using the curly brackets for the data-string parameter?

{ \"auth_token\": \"pass\", \"text\": \"Off\" }

For example, if you look at our earlier Instapush thread, there the datastring is surrounded by curly brackets.

This is probably because they are using JSON, so the datastring needs to be in JSON format.

I'm not sure if you would need the escaping backslashes, but I would start by leaving them in.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

Just talked to the boss.

James says it's extremely unlikely that you'll need the \'s in VC -- and that these are more likely to cause errors in VC.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Haddood

you guys rock ... it was the curly brackets that are missing ... and no need for escape backslashes ...

thank you :) now I can go forward with developing my dashboard ..
When Voice command gets tough, use hand gestures

nime5ter

Great.

If/when you have time, maybe you can post some VC-related dashing.io accomplishments and tips to the forum?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Haddood

When Voice command gets tough, use hand gestures