DarbyM
DarbyM

Reputation: 1203

curl syntax not working. Rest API testing

Setup: I use the following link to test my REST api in Postman and it works fine:

xxx.xxx.xxx.xxx/API/v1/RefreshTableCache?tables=UniqueLineNumbers,SpoolInfo&jobnumber=1234

Problem: But trying to run it form unix command line it fails.

wget -S -q -O - xxx.xxx.xxx.xxx/API/v1/RefreshTableCache?tables=UniqueLineNumbers,SpoolInfo&jobnumber=1234

Looking at the API output, it is never receiving the jobnumber parameter.

Question:

What is the proper syntax to make wget or even curl pass the parameter??

Upvotes: 0

Views: 69

Answers (1)

Paul Samsotha
Paul Samsotha

Reputation: 208984

The & has a special meaning in the terminal. So when it is used in the URL, it is treated as that special character. To get around that, just wrap the URL in quotes

curl 'http://<...>/path?param1=value1&param2=value2'

Upvotes: 2

Related Questions