百度网盘API调用一

2021-07-05 04:05

阅读:727

标签:接口   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


评论


亲,登录后才可以留言!