Solved

Issue with cURL on Windows

Posted on 2016-10-04
7
153 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

707 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