?
Solved

Issue with cURL on Windows

Posted on 2016-10-04
7
Medium Priority
?
195 Views
Last Modified: 2016-10-27
I have a command that runs fine on Linux but not Windows

curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "d: """ -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d '' "http://mytaglist.com/ethClient.asmx/GetTagList"

Can anyone help?

note: I've obscured the security credentials
0
Comment
Question by:aideb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 41829460
How about posting the error you get? That may help us find what's wrong.
0
 
LVL 85

Expert Comment

by:oBdA
ID: 41829807
The first thing to do is to run the command without "-silent".
That said, two issues are already obvious:
- What is -H "d: """ supposed to be? If you want to escape double quotes inside double quotes in a Windows command line, use the backslash as escape character.
- The -d '' "http://mytaglist.com/ethClient.asmx/GetTagList" at the end has a superfluous double quote right after the "-d".
0
 
LVL 2

Author Comment

by:aideb
ID: 41832780
Without --silent the errors are

curl: (6) Could not resolve host: no-cache -H Postman-Token
curl: (6) Could not resolve host: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe -d '' http

I'm not sure of the rationale for the code, I lifted it from something that works on my mac and linux boxes. Strange that it just doesn't work straight off on Windows

After the -d is two single quotes - again I'm unsure of the purpose

Any help would be much appreciated
0
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
LVL 85

Expert Comment

by:oBdA
ID: 41834459
Try
curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d "http://mytaglist.com/ethClient.asmx/GetTagList"

Open in new window

or
curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "d: \"\"" -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d "http://mytaglist.com/ethClient.asmx/GetTagList"

Open in new window

0
 
LVL 2

Author Comment

by:aideb
ID: 41838905
Thanks for the suggestion - i get

curl: no URL specified!
0
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 41838949
Then maybe these:
curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "d: \"\"" -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d "" "http://mytaglist.com/ethClient.asmx/GetTagList"

Open in new window

curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d "" "http://mytaglist.com/ethClient.asmx/GetTagList"

Open in new window

1
 
LVL 2

Author Closing Comment

by:aideb
ID: 41862944
Thanks  - This one worked!

curl --silent -X POST -H "host: mytaglist.com" -H "Content-Type: application/json; charset=utf-8" -H "Authorization: bearer XXXXX-0fa9-4258-b8d0-98aa6157d21e" -H "d: \"\"" -H "Cache-Control: no-cache" -H "Postman-Token: XXXXXX-2c1f-96ce-2ca7-033fab5b83fe" -d "" "http://mytaglist.com/ethClient.asmx/GetTagList"
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question