Author Topic: translating cURL to Scrape  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

Haddood

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
translating cURL to Scrape
« on: January 04, 2016, 05:24:34 PM »
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


Code: [Select]
<?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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: translating cURL to Scrape
« Reply #1 on: January 04, 2016, 05:43:08 PM »
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?

Code: [Select]
{ \"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.
« Last Edit: January 04, 2016, 06:23:35 PM by nime5ter »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: translating cURL to Scrape
« Reply #2 on: January 04, 2016, 05:50:31 PM »
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

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: translating cURL to Scrape
« Reply #3 on: January 04, 2016, 06:29:40 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: translating cURL to Scrape
« Reply #4 on: January 05, 2016, 12:12:53 PM »
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

  • $upporter
  • Hero Member
  • *****
  • Posts: 688
  • Karma: 22
    • View Profile
Re: translating cURL to Scrape
« Reply #5 on: January 05, 2016, 05:35:20 PM »
I was planning on that :)
When Voice command gets tough, use hand gestures