Add folder Api v2


kibrock

Recommended Posts

Hello.

I use the api v2 and try to add a folder to synchronize the POST request: 

"curl -X POST -H "Content-Type: application/json" -d '{"path": "c:\temp"}' http://localhost:8899/api/v2/folders",

but get an error: "curl: (3) [globbing] unmatched close brace/bracket in column 8",

at the same time GET request: "curl -X GET http://localhost:8899/api/v2/folders"  works fine,

help me please, what am I doing wrong?

P.S. Sorry for my English.

Link to comment
Share on other sites

@kibrock Some comments on your request:

  1. Some versions of CURL may be sensitive to the order of arguments. So I suggest next order: curl <username-pass> <method> <url> <content-type> <request content>
  2. When requesting any method except GET, you need to supply cookies and security token. Please see below a sample of changing the device name with POST method.
curl -c cookie -u admin:pass http://localhost:8888/api/v2/token

curl -b cookie -u admin:pass -X POST http://localhost:8888/api/v2/owner?token=jFMy-j2Mtoy3-ucVeB5lcE6A41nGNqqlrToTeflPoIgPpCxeF6qNXXzk1lYAAAAA -H "Content-Type:application/json" -d '{"username":"John Doe","devicename":"Test Machine"}'

cookie is the file to store cookies, while "token" value is received in /api/v2/token call.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.