6

I have a pretty simple Postman request that works just fine in Postman. It's just a GET request to the following URL:

http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false

If I ask Postman to make a cURL request out of that for me, it gives me this:

curl -X GET \
  'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude=&longitude=&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' \
  -H 'cache-control: no-cache' \
  -H 'postman-token: b4ae79c0-c3f0-8247-8c2f-306c43376039'

The result is that it just hangs forever and never gives me a response.

Any idea what can be done to get the cURL request working?

Saikat
  • 14,222
  • 20
  • 104
  • 125
Jason Swett
  • 43,526
  • 67
  • 220
  • 351

3 Answers3

8

It seems the server has banned curl user-agent, also the cookies troute=t1 needs to be set otherwise it returns 404 :

curl -L -H 'User-Agent: Mozilla' \
        -H 'Cookie: troute=t1;' \
        'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' --compressed
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
3

Beware of the cookie monster

Not all Postman requests are made equal.

Postman will store cookies whether you like it or not (and send them over in subsequent calls to the same domain).

I didn't realize my first call to the same domain was receiving a cookie that was sent back on the next call from Postman. So even though everything looked the same, I wasn't sending the cookie through curl.

bubbassauro
  • 3,969
  • 2
  • 45
  • 45
0

If this is a GET request, without a body, from within Postman, remember to specify the body parameter as "none" so that a --Data [] parameter is not generated for the cURL code: enter image description here

UnderToe
  • 1
  • 2