使用API​​更新Podio个人资料图片

时间:2016-09-22 12:52:49

标签: api podio

我们计划制作Podio Out of Office扩展程序,以便人们可以添加开始日期和结束日期,并且在此期间,个人资料图片将自动更改为不在办公室版本。

我们无法在Podio API文档中看到一种方法,并根据official comment here尝试了解决方案。

但是这种方法现在还不行。这是我们收到的错误

enter image description here

有关如何执行此操作的任何帮助?

1 个答案:

答案 0 :(得分:4)

请尝试使用https而不是http,并尝试使用PUT而不是POST。

curl -H "Content-Type: application/json" 
     -H "Authorization: OAuth2 <my_auth_token>" 
     -X PUT 
     -d '{"avatar":<avatar_id>}'
     "https://api.podio.com/contact/<profile_id>"

整个解决方案:

  1. 获取用户当前个人资料GET /contact/user/{user_id}(让我们调用结果p
  2. p.image.link获取用户头像(应为网址)
  3. 下载并更改图片
  4. 作为用户:上传图片 - 获取文件ID,我们称之为image_id
  5. 作为用户:PUT/contact/{p.profile_id}{"avatar" : <image_id>}