Pinch
Pinch

Reputation: 4207

Wget and .net WebAPI

I created a simple restless webapi that takes a few variables and returns a simple Success or Fail

This works great in Fiddler.

http://www.####.com/myapi/api/SettingsConfig POST HTTP/1.1

Request Headers

User-Agent: Fiddler

Host: www.######.com

Content-Length: 143

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Request Body

PBXNumber=6461111111&Username=me&Password=you&enable=True

My client wants to use Wget to post to my Webapi:

He tried:

wget.exe https://www.####.com/myapi/api/SettingsConfig --post-data 'PBXNumber=6461111111&Username=mew&Password=you&enable=True'

and gets

'Username' is not recognized as an internal or external command, operable program or batch file. 'Password' is not recognized as an internal or external command, operable program or batch file. 'enable' is not recognized as an internal or external command, operable program or batch file.

Please tell me as i am so at lost what to do!

Upvotes: 0

Views: 852

Answers (1)

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174329

The ampersands & are special characters in the bash shell. You need to escape them with a backslash:

wget.exe https://www.####.com/myapi/api/SettingsConfig --post-data 'PBXNumber=6461111111\&Username=mew\&Password=you\&enable=True'

Upvotes: 1

Related Questions