Solved

Issue with cURL on Windows

Posted on 2016-10-04
7
112 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 84

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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 84

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 84

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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