Post

4 followers Follow
0
Avatar

Profile Picture

Is there an api to download the current picture of a user, apply a change to the picture and re-upload it?

Anthony W Stefani

Official comment

Avatar

No there isn't a single API that would help you with this, but with a bit hacking it should be doable. Note that this needs to be done as the user since only a user can update their own profile.

Basically you need to

  1. Get the users current profile `GET /contact/user/{user_id}` (let's call the result `p`)
  2. Get the users avatar from `p.image.link` (should be a URL)
  3. Alter the image
  4. As the user: Upload the image - get the ID - links call it image_id
  5. As the user: `POST` to `/contact/{p.profile_id}` the value `{"avatar" : <image_id>}`.

Cheers,

Brian

Brian Stengaard

Please sign in to leave a comment.

4 comments

0
Avatar

{
"error_parameters": {},
"error_detail": null,
"error_propagate": false,
"request": {
"url": "http://api.podio.com/contact/{[profileId]}",
"query_string": "",
"method": "POST"
},
"error_description": "No matching operation could be found. The path '/contact/{[profileId]}' was not found..",
"error": "not_found"
}

 

why it is happening?

Akbar Badhusha 0 votes
0
Avatar

I am trying to write a PHP app to update External User avatar images. It seems external users don't always set their avatar images and I would like to do that FOR them by setting their avatar image to something more unique (like a box with the first letter of their first & last names and a color like Google does).

This means this PHP app would have to have the ability to UPDATE the user Profile record. It sounds like that is *only* possible when the user does this, so can you recommend a way to implement this? Perhaps I could have a webpage that is called while the user is logged in that would do this? Any suggestions? Perhaps send a link to the user that requests Auth that the user can "approve" that then allows the app to update their Avatar image?

Thanks in advance for any input.

 

UPDATE: I figured it out. Here is the code that works:


$puup = PodioUser::update_profile(array(
"avatar" => $file_id,
));

 

Andrew Fields 0 votes