从onedrive获取所有缩略图

Get all thumbnails from onedrive

我正在尝试从名为 'Pictures' 的文件夹中获取所有图片, 但是我遇到了错误的请求错误,这是我的代码:

const uri = "https://api.onedrive.com/v1.0/Drive/";

    $("#btLeshoto").click(function () {
        //set url for the leshoto folder
        url += uri + "Pictures/children?$top=1000&access_token=" + token;
        loadImages();
    })


function loadImages() {
    $.ajax({
        url: url,
        dataType: 'json',
        // beforeSend: function(xhr){xhr.setRequestHeader('Authorization', token);}

    }).then(function (data) {
}}

我尝试过使用 apigee,但没有成功。也许有人可以帮助我吗? 谢谢

您希望您的 URL 最终看起来像这样:

https://api.onedrive.com/v1.0/drive/root:/Pictures:/children

与您目前拥有的主要区别:

  1. 您需要指定起始项,因此在本例中我们将 root 放在 drive 之后。
  2. 要使用路径,您需要 "switch" 路径语义(因此 URL 段不会被视为对象模型的一部分),并类似地切换回访问再次对象模型。这是通过 :