I am trying to download some data in the form of
json from a
SharePoint API. I was able to do it using
wget --user user --password password --header='Accept: application/json;odata=verbose' "URL"
and I am trying to do the same thing with CURL.
I tried using different headers and authentication mechanisms, but it always gives me the bad request error. Below are the commands I tried:
curl -v --user user:password "URL" curl -v --user user:password -H 'Accept: application/json;odata=verbose' "URL" curl -v --ntlm --user user:password -H 'Accept: application/xml' "URL" curl -v --anyauth --user user:password -H 'Accept: application/xml' "URL"
Below is the output I get:
* About to connect() to sharepoint2.domain.com port 80 (#0) * Trying xx.xx.xx.xx... connected * Connected to sharepoint2.domain.com (xx.xx.xx.xx) port 80 (#0) > GET <path> HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: sharepoint2.domain.com > Accept: application/json;odata=verbose > < HTTP/1.1 400 Bad Request < Content-Type: text/html; charset=us-ascii < Server: Microsoft-HTTPAPI/2.0 < Date: Mon, 12 Feb 2018 21:45:06 GMT < Connection: close < Content-Length: 311 < <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <HTML><HEAD><TITLE>Bad Request</TITLE> <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD> <BODY><h2>Bad Request</h2> <hr><p>HTTP Error 400. The request is badly formed.</p> </BODY></HTML> * Closing connection #0
I am not sure what’s going wrong. How do I solve the issue and pull the data with CURL ?
Any help would be appreciated. Thank you.
✓ Extra quality
ExtraProxies brings the best proxy quality for you with our private and reliable proxies
✓ Extra anonymity
Top level of anonymity and 100% safe proxies – this is what you get with every proxy package
✓ Extra speed
1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!
USA proxy location
We offer premium quality USA private proxies – the most essential proxies you can ever want from USA
Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies
Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!
Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!
99,9% servers uptime
Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems
No usage restrictions
You have freedom to use your proxies with every software, browser or website you want without restrictions
Perfect for SEO
We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies
Buy more proxies and get better price – we offer various proxy packages with great deals and discounts
We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!