码迷,mamicode.com
首页 > Windows程序 > 详细

百度网盘API调用一

时间:2018-10-23 01:16:09      阅读:652      评论:0      收藏:0      [点我收藏+]

标签:接口   ESS   use   basic   ssi   val   bdd   .com   dev   


获取api_key
api_key : GSccEhhbzxM4jKi5kqABPfwn
secret_key : CDGOGIE8ZAIP3qooKbUpLpUrxnP2PUvo
get:
http://developer.baidu.com/rest/2.0/dev/v1/app/base/get?app_id=14512550&access_token=10.182e0fcde4fc1551180b8303cd35dcfd.1540223376.1183630

 

1.在浏览器中输入:获取授权码:2220bc6cbf1dc533cce7968963f20c23
https://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=GSccEhhbzxM4jKi5kqABPfwn&redirect_uri=oob


3.通过刚刚新建应用的API Key获取device code和user_code
curl -k -L -d "client_id=GSccEhhbzxM4jKi5kqABPfwn&response_type=device_code&scope=basic,netdisk" "https://openapi.baidu.com/oauth/2.0/device/code"
{"device_code":"b4adab18f1ef0807d62cebddac2adea7","user_code":"u67xpvun","verification_url":"https:\/\/openapi.baidu.com\/device","qrcode_url":"http:\/\/openapi.baidu.com\/device\/qrcode\/0f274a778605dc24bae7dec0b612e5f9\/u67xpvun","expires_in":1800,"interval":5}

4.获取access_token:
curl -k -L -d "grant_type=device_token&code=b4adab18f1ef0807d62cebddac2adea7&client_id=GSccEhhbzxM4jKi5kqABPfwn&client_secret=CDGOGIE8ZAIP3qooKbUpLpUrxnP2PUvo" "https://openapi.baidu.com/oauth/2.0/token"
{"expires_in":2592000,"refresh_token":"27.4ce9e9aaa03764f915a19a754180e367.315360000.1855584874.2659222677-14512550","access_token":"26.773c43533edc9c14df1c58419a335cc7.2592000.1542816874.2659222677-14512550","session_secret":"5d7d9804b4c3ab764924ef8198edf593","session_key":"9m7YJ\/56bOAlfLeTQi7\/9fFV2OWXQOFWaBZ+VIvhJvz1GTtHaKk7WYRv6GHRPLtlLXl92\/l5Sg1lK4yWpjM590j2FlVLe74iow8=","scope":"basic netdisk"}


5.查看网盘配额:一下接口报错{"error_code":31024,"error_msg":"app id is empty","request_id":6842223964839647037}

curl -k -L "https://pcs.baidu.com/rest/2.0/pcs/quota?method=info&access_token=26.773c43533edc9c14df1c58419a335cc7.2592000.1542816874.2659222677-14512550&client_id=GSccEhhbzxM4jKi5kqABPfwn"


curl -k -L "https://pcs.baidu.com/rest/2.0/pcs/file?method=list&access_token=26.773c43533edc9c14df1c58419a335cc7.2592000.1542816874.2659222677-14512550&client_id=GSccEhhbzxM4jKi5kqABPfwn&client_secret=CDGOGIE8ZAIP3qooKbUpLpUrxnP2PUvo&path=/apps/pcsupload/"

 

百度网盘API调用一

标签:接口   ESS   use   basic   ssi   val   bdd   .com   dev   

原文地址:https://www.cnblogs.com/gzu-link-pyu/p/9834028.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!