Using Baidu Cloud Disk API to upload files to Baidu cloud disk

Source: Internet
Author: User
Tags oauth

First, get access token sample

1. Please paste the following HTTP request directly into the browser address bar and press ENTER.

https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=l6g70tbrrixlsy0z3hwkqlre& Redirect_uri=oob&scope=netdisk

2, after the implementation, pop-up Baidu login page, login after the following authorization page:

3, after the authorization, will jump to the following Baidu OAuth2.0 page:

4, please copy the contents of this page address bar, you will see: http://openapi.baidu.com/oauth/2.0/login_success#expires_in=2592000&Access_ token=3.811a254908d094012df764a38882a179.2592000.1348661720.2233553628-238347&session_secret= 9deaa587f9cd177f02079506dc4391ab&session_key=94rrnl7qf2cyvnsz0kfarwls%2bimuqn%2fbzkgbybenwdzv1o% 2bzp7fjxo8cn%2brrhlaqsjy8febd2sp6ioux%2b2tw6igr8jfigsu%3d&scope=basic+netdisk

Description: The red word is access_token.

Second, upload the file test

Curl-k-l-f "[Email protected]/usr/local/dbbak/dsideal_db-2015-11-21=03:00:02.sql.gz" "https://c.pcs.baidu.com/ rest/2.0/pcs/file?method=upload&access_token=<your_access_token>&path=/apps/pcstest_ Oauth/test/data.gz "

Description: The upload file must be in the/apps/pcstest_oauth/directory.

Iii. Other explanatory documents

#获取token
Description Document: Http://developer.baidu.com/wiki/index.php?title=docs/pcs/guide/usage_example
#获取token地址
https://openapi.baidu.com/oauth/2.0/authorize?response_type=token&client_id=l6g70tbrrixlsy0z3hwkqlre& Redirect_uri=oob&scope=netdisk
#从地址栏中粘出access_token
access_token=23.d72bff6b9eccb230356267c2a01f8bfd.2592000.1451093998.1829018343-238347
============================================================================================
#上传文件测试
Curl-k-l-f "[Email protected]/usr/local/dbbak/dsideal_db-2015-11-21=03:00:02.sql.gz" "https://c.pcs.baidu.com/ Rest/2.0/pcs/file?method=upload&access_token=23. c55ce5b45ca4b4b478a34aacbf78fb70.2592000.1451091550.1829018343-238347&path=/apps/pcstest_oauth/test/ Data.gz "
Description Document: Http://developer.baidu.com/wiki/index.php?title=docs/pcs/rest/file_data_apis_list
============================================================================================
Other documents: http://my.oschina.net/bygreencn/blog/193838
============================================================================================

Using Baidu Cloud Disk API to upload files to Baidu cloud disk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.