CURL

Posted on
Thu Oct 29, 2009 9:56 pm
trekinsanity offline
Posts: 42
Joined: Sep 11, 2004

CURL

I am trying to use curl to change an Indigo variable, called test. However, I keep getting "access denied." (FYI: I am using the correct login info.)

The format I am using is:

curl -u username:password -X PUT -d value=[hi] http://127.0.0.1:port/variables/test

Any ideas?

Posted on
Thu Oct 29, 2009 10:25 pm
berkinet offline
User avatar
Posts: 3298
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

(No subject)

url -u username:password -X PUT -d value=[hi] http://127.0.0.1:port/variables/test
Could you post the real values you are using (well, do change the username and password)

Posted on
Fri Oct 30, 2009 8:02 am
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

(No subject)

First, try turning off authentication for testing. Second you're missing some hidden arguments. This works for me
Code: Select all
curl -d 'value="what ever"&_method=put&_onlyChanges=1&_blockUntilIdle=1' http://10.1.2.3:8176/variables/test

With out the hidden args I get a "405 Method Not Allowed". What exactly do you get?

(-X POST is implied with -d)

Posted on
Fri Oct 30, 2009 9:05 am
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

(No subject)

I was going to delete my test variable and saw the quotes around what ever getting into Indigo.
Code: Select all
curl -d "value=what ever&_method=put&_onlyChanges=1&_blockUntilIdle=1" http://10.1.2.3:8176/variables/test

works fine.

Posted on
Fri Oct 30, 2009 9:13 am
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

(No subject)

FYI, you should be able to drop those hidden variables if you tell curl to use PUT (like Trek's example):
Code: Select all
curl -x PUT -d "value=what ever" http://10.1.2.3:8176/variables/test

Regarding the authentication failure, try passing curl the --digest option. Indigo requires the more secure HTTP Digest (not Basic) authentication.

Image

Posted on
Fri Oct 30, 2009 10:05 am
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

(No subject)

Code: Select all
curl -d "value=zwhat ever&_method=put" http://10.1.2.3:8176/variables/test

Works for me. But
Code: Select all
curl -X POST -d "value=zwhat ever" http://10.1.2.3:8176/variables/test

Gives a 405 Method Not Allowed

In any case, I wasn't aware this existed, cool, thanks. I've got to look at the built in web server again.

Posted on
Fri Oct 30, 2009 10:08 am
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

(No subject)

But does using '-X PUT' (not POST) work for you?

Image

Posted on
Fri Oct 30, 2009 10:51 am
CharlieParker offline
Posts: 241
Joined: Apr 10, 2006
Location: Lower Hudson Valley

(No subject)

PUT works, sorry I have currently have project where curl posting is an issue. Basically disregard everything I've said.

Posted on
Wed Nov 11, 2009 8:32 pm
trekinsanity offline
Posts: 42
Joined: Sep 11, 2004

(No subject)

Matt,

HOw do you exactly use the curl w/ the --digest? Can you give an example?

Posted on
Wed Nov 11, 2009 9:10 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

(No subject)

I've never tried it before, but based on the man page, I would think you would just add --digest as a command line argument to your example in the top post on this thread.

Image

Posted on
Fri Apr 04, 2014 5:11 am
gboudreau offline
User avatar
Posts: 10
Joined: Feb 16, 2011
Location: Montreal, Canada

Re: CURL

Sorry to revive this very old thread, but I found it using Google, when I searched how to send the username and password using cURL to Indigo.
The trick is to add --anyauth to the curl command:
Code: Select all
curl -u username:password --anyauth ...

Without --anyauth, it just won't work.

- Guillaume Boudreau

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests