LoginSignup
1
0

More than 3 years have passed since last update.

JavaScriptでDropbox APIから読み込む

Last updated at Posted at 2021-03-26

とりあえず動いた喜びとメモ帳書きとして

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <title>Dropbox Test</title>
    <script src="https://unpkg.com/dropbox/dist/Dropbox-sdk.min.js"></script>
</head>
<body>
<h1>DropBox Test</h1>
<script>
    let accessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    let dbx = new Dropbox.Dropbox({accessToken: accessToken});

    dbx.usersGetCurrentAccount()
        .then(function (response) {
            console.log(JSON.stringify(response, null, 4));
        })
        .catch(function (error) {
            console.error(error);
        });

    let dir_path = "/document"
    dbx.filesListFolder({path: dir_path})
        .then(function (response) {
            console.log(JSON.stringify(response, null, 4));
        })
        .catch(function (error) {
            console.error("error " + error);
        });
</script>
</body>
</html>

参考

知識ゼロだけど、Dropbox APIを使用したい
https://qiita.com/Ella_Engelhardt/items/c33f08b6b427eab8b310

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0