【问题标题】:Get embed URL through onedrive API通过 onedrive API 获取嵌入 URL
【发布时间】:2019-01-22 14:09:57
【问题描述】:

有没有办法通过 onedrive 的 API 获取嵌入 URL。

嵌入 URL 是可公开访问的 URL,不需要登录,因为它包含 authkey。

我确实设法获得了 cid 和 resid,但是,我不知道如何获得 authkey。有没有办法得到它? 我目前正在使用 onedrive 的 python SDK。

【问题讨论】:

  • 您找到解决方案了吗?

标签: onedrive


【解决方案1】:

您应该能够使用createLink API 来请求embed 链接。

POST /me/drive/items/{item-id}/createLink
Content-Type: application/json

{
  "type": "embed"
}

详情请参阅this documentation

SDK 还应该公开createLink,因此上述内容应该相对容易地映射到您的用例中。

【讨论】:

  • 我确实设法得到一个对象来响应https://login.live.com/oauth20_token.srf。这个对象有一个refresh_token 和一个auth_token。但是,如果我同时调用https://graph.microsoft.com/v1.0/me'Authorization': "Bearer " + access_token_for_graph,,我会得到“error”:{“code”:“InvalidAuthenticationToken”,“message”:“CompactToken 解析失败,错误代码:8004920A”,“innerError”:{“request -id”:“somerequestid”,“日期”:“2019-01-23T06:37:14”} } }
  • 另外,因为我已经在一个驱动器上使用了 python sdk,我已经成功地使用client.item(drive='me', id='root').children['document_14_01_2019_3_36_PM.xlsx'].upload( './' + 'document_14_01_2019_3_36_PM.xlsx') 上传了一个文件。我不能使用与createlinitem 类似的方法吗?
  • @Abhilash,您找到解决方案了吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-10-25
  • 2014-08-06
  • 1970-01-01
相关资源
最近更新 更多