OneDrive APIについて
2016.12.05
前回
前回にOneDriveでトークンの取得までをやったので、今回はそれを使ったディレクトリやファイルの取得までをちょっとつついておく。
基本的な形は下記。
https://api.onedrive.com/{api-version}/drive/root/children?access_token={access token}
ぼくは任意のディレクトリに入っているアイテム一覧がほしいので下記のようにカスタマイズ。https://api.onedrive.com/{api-version}/drive/items/{id}/children?access_token={access token}
https://dev.onedrive.com/resources/item.htm
ディレクトリのIDは自分でブラウザを使ってOneDriveにログインして、IDを知りたいディレクトリに入ればURLのクエリにそれを確認することができる。
あとはパラメータでオーダーやフィルターが使える。
https://api.onedrive.com/{api-version}/drive/items/{id}/children?access_token={access token}&orderby=name%20desc
https://dev.onedrive.com/odata/optional-query-parameters.htm
前回にOneDriveでトークンの取得までをやったので、今回はそれを使ったディレクトリやファイルの取得までをちょっとつついておく。
基本的な形は下記。
https://api.onedrive.com/{api-version}/drive/root/children?access_token={access token}
ぼくは任意のディレクトリに入っているアイテム一覧がほしいので下記のようにカスタマイズ。https://api.onedrive.com/{api-version}/drive/items/{id}/children?access_token={access token}
https://dev.onedrive.com/resources/item.htm
ディレクトリのIDは自分でブラウザを使ってOneDriveにログインして、IDを知りたいディレクトリに入ればURLのクエリにそれを確認することができる。
あとはパラメータでオーダーやフィルターが使える。
https://api.onedrive.com/{api-version}/drive/items/{id}/children?access_token={access token}&orderby=name%20desc
https://dev.onedrive.com/odata/optional-query-parameters.htm
comment: 0