Forum Discussion
A problem when download OneNote file using OneDrive api by curl
Hi Everyone,
When I try to download onenote files by OneDrive api, curl returns 56 when sending download requests for some onenote files.
Below is one of the details of the api request/reponse. I have tried to request the metadata of that onenote file and the api behaved as expected, so it seems that the issue is only related to the download itself.
Is it OneDrive api limitation such that some onenote files could not be downloaded ?
If I want to backup whole onenote file From M365 OneNote/Sharepoint, is oneNote api suitable to download all components of onenote file ? And is it suitable to restore the backup file to M365 OneDrive/SharePoint ?
```
curl -v --location --request GET 'https://xxxx-my.sharepoint.com/_api/v2.0/drives/<my_drive_id>/items/<my_item_id>/content' --header 'Authorization: Bearer <Bearer>'
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 302
< cache-control: no-cache, no-store
< pragma: no-cache
< content-type: application/octet-stream
< expires: -1
< location: https://xxxx.sharepoint.com/sites/OS0709-D/_layouts/15/download.aspx?UniqueId=<uid>&Translate=false&tempauth=<tempauth>&ApiVersion=2.0
< p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< x-networkstatistics: 0,525568,0,0,2094697,0,379488
< x-sharepointhealthscore: 3
< x-sp-serverstate: ReadOnly=0
< odata-version: 4.0
< x-download-options: noopen
< content-disposition: attachment
< spclientservicerequestduration: 36
< sprequestduration: 37
< x-aspnet-version: 4.0.30319
< x-databoundary: EU
< x-1dscollectorurl: https://eu-mobile.events.data.microsoft.com/OneCollector/1.0/
< x-ariacollectorurl: https://eu-mobile.events.data.microsoft.com/Collector/3.0
< sprequestguid: ea24d6a0-107c-7000-3c47-9471817ea836
< request-id: ea24d6a0-107c-7000-3c47-9471817ea836
< ms-cv: oNYk6nwQAHA8R5RxgX6oNg.0
< strict-transport-security: max-age=31536000
< x-frame-options: SAMEORIGIN
< content-security-policy: frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.microsoftonline.cn *.powerapps.com *.yammer.com *.officeapps.live.com *.office.com *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com;
< x-powered-by: ASP.NET
< microsoftsharepointteamservices: 16.0.0.24016
< x-content-type-options: nosniff
< x-ms-invokeapp: 1; RequireReadOnly
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: FC459A849CD54010845E23ECF71439CD Ref B: TPE30EDGE0912 Ref C: 2023-09-01T09:45:07Z
< date: Fri, 01 Sep 2023 09:45:07 GMT
< content-length: 0
<
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /sites/OS0709-D/_layouts/15/download.aspx?UniqueId=<uid>&Translate=false&tempauth=<tempauth>&ApiVersion=2.0 HTTP/2
> Host: xxxx.sharepoint.com
> user-agent: curl/7.86.0
> accept: */*
>
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
< HTTP/2 302
< cache-control: private
< content-type: text/plain
< location: https://190124-ipv4v6.gr.global.aa-rt.sharepoint.com/sites/OS0709-D/_layouts/15/download.aspx?UniqueId=<uid>&Translate=false&siteHost=xxxx.sharepoint.com&tempauth=<tempauth>&ApiVersion=2.0
< p3p: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
< x-networkstatistics: 0,525568,0,0,687952,0,97344
< x-sharepointhealthscore: 2
< sprequestguid: ea24d6a0-409a-7000-3c47-93101f35ea5e
< request-id: ea24d6a0-409a-7000-3c47-93101f35ea5e
< ms-cv: oNYk6ppAAHA8R5MQHzXqXg.0
< strict-transport-security: max-age=31536000
< x-aspnet-version: 4.0.30319
< sprequestduration: 25
< spiislatency: 1
< x-powered-by: ASP.NET
< microsoftsharepointteamservices: 16.0.0.24016
< x-content-type-options: nosniff
< x-ms-invokeapp: 1; RequireReadOnly
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: 0A695B98792B463DA2C4B0329A0DCE1E Ref B: TPE30EDGE0609 Ref C: 2023-09-01T09:45:08Z
< date: Fri, 01 Sep 2023 09:45:07 GMT
< content-length: 0
<
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> GET /sites/OS0709-D/_layouts/15/download.aspx?UniqueId=<uid>&Translate=false&siteHost=xxxx.sharepoint.com&tempauth=<tempauth>&ApiVersion=2.0 HTTP/1.1
> Host: 190124-ipv4v6.gr.global.aa-rt.sharepoint.com
> User-Agent: curl/7.86.0
> Accept: */*
>
* TLSv1.2 (OUT), TLS header, Unknown (21):
* TLSv1.2 (OUT), TLS alert, decode error (562):
* OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
curl: (56) OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0
```
- Joe WuCopper ContributorIs there any Microsoft technical support or engineer can check this issue?