'Can't upload json file to SharePoint by curl
Linux Mint 20.3
If I want to upload json file as text file I use this command:
curl --ntlm --user 'myUser@myDomain.:!myPass' --upload-file sonarqube_report_severity.json -k http://some_sharepoint_url_here/report_severity.txt
Nice, it's work fine. As result on remote host , now exist file report_severity.txt
But if I want to upload json file as json file like this:
curl --ntlm --user 'myUser@myDomain.:!myPass' --upload-file sonarqube_report_severity.json -k http://some_sharepoint_url_here/report_severity.json
I get error:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="http://some_sharepoint_url_here/_layouts/error.aspx">here</a>.</h2>
</body></html>
Details:
* Trying 10.102.11.11:80...
* TCP_NODELAY set
* Connected to some_host-here (10.102.11.11) port 80 (#0)
* Server auth using NTLM with user 'myUser@myDomain.'
> PUT /some_sharepoint_url_here/report.json HTTP/1.1
> Host: some_host-here
> Authorization: NTLM TlRMTVNTUAABAAAABoIIA
> User-Agent: curl/7.68.0
> Accept: */*
> Referer: rbose
> Content-Length: 0
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401 Unauthorized
< Server: Microsoft-IIS/7.5
< SPRequestGuid: 98dce97c-c853-42d4-8249-c09ca4474942
< WWW-Authenticate: NTLM TlRMTVNTUAACAAAADA
< WWW-Authenticate: Negotiate
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 14.0.0.6106
< Date: Tue, 05 Apr 2022 12:23:54 GMT
< Content-Length: 0
<
* Connection #0 to host some_host-here left intact
* Issue another request to this URL: 'http://some_sharepoint_url_here-here/report_severity2.json'
* Found bundle for host some_host-here: 0x564a55b54b70 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host some_host-here
* Connected to some_host-here (10.102.11.11) port 80 (#0)
* Server auth using NTLM with user 'myUser@myDomain.'
> PUT /report.json HTTP/1.1
> Host: some_host-here
> Authorization: NTLM TlRMTVNTUAADAAAAGAAYA=
> User-Agent: curl/7.68.0
> Accept: */*
> Referer: rbose
> Content-Length: 208913
> Expect: 100-continue
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Cache-Control: private
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=utf-8
< Location: http://some_host-here/SiteDirectory/Research_and_Development/Software%20Project%20Group/_layouts/error.aspx
< Server: Microsoft-IIS/7.5
< SPRequestGuid: d39d833-7080ede8d99f
< Set-Cookie: WSS_KeepSessionAuthenticated={4a46b570e9a0ddfc}; path=/
< X-SharePointHealthScore: 0
< X-AspNet-Version: 2.0.50727
< Persistent-Auth: true
< X-Powered-By: ASP.NET
< MicrosoftSharePointTeamServices: 14.0.0.6106
< Date: Tue, 05 Apr 2022 12:23:54 GMT
* HTTP error before end of send, stop sending
<
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="http://some_url_here/_layouts/error.aspx">here</a>.</h2>
</body></html>
* Closing connection 0
P.S. I can success manually upload json file via SharePoint web client.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
