Bulk Upload Avatars
Upload avatar images and attach them to user profiles in bulk.
This guide walks through uploading avatar images and attaching them to user profiles in bulk: get each user's ID, upload the image file, then tie the uploaded avatar to the profile.
Step 1: Get all user IDs
Get the id of every user in your workspace:
curl -u $GURU_USER:$GURU_TOKEN https://api.getguru.com/api/v1/membersYou'll need the user.id for each user in Step 3. The response, truncated to the relevant fields:
[
{
"user": {
"id": "99af1e84-a0d6-4c56-92b1-5382cf1cdade",
"status": "ACTIVE",
"email": "[email protected]",
"lastName": "Iversonn",
"firstName": "Allen",
"profilePicUrl": "https://pp.getguru.com/3a6767f90e994119a0877c2c071599df.png"
},
"id": "[email protected]",
"dateCreated": "2022-02-09T22:01:59.136+0000",
...
},
...
]Step 2: Upload the avatar file
Upload the image to Guru's system. This step only gets the file into Guru; tying the avatar to the user profile happens in Step 3.
The request body type is form-data, with the key profilePic (file type) set to the file you're uploading:
curl -X POST https://api.getguru.com/app/picture \
-u $GURU_USER:$GURU_TOKEN \
-H "Accept: application/json" \
-F 'profilePic=@"/Users/me/Downloads/myAvatar.png"'The response contains the uploaded picture's URL:
{
"uploadedPictureUrl": "https://pp.getguru.com/e4039932194jg3df8b3f7cf997a94a06.png"
}Step 3: Tie the uploaded avatar to the profile
With the user's ID (Step 1) and the avatar URL (Step 2), first get the current state of the user's profile:
curl -u $GURU_USER:$GURU_TOKEN https://api.getguru.com/api/v1/people/USERID{
"pronouns": "",
"displayName": "Joe Beddia",
"manager": {
"displayName": "Joe Duffy Admin",
"userId": "f92b946e-b1e6-4ec9-adac-7e5c9ed9244e",
"id": "ef336cec-1de6-4960-a33f-def3625f8efb",
"email": "[email protected]",
"profilePicUrl": "https://pp.getguru.com/e4039970b78648df8b3f7cf997a94a06.png",
"lastName": "Duffy Admin",
"firstName": "Joe"
},
"userId": "8e20337e-f173-45bf-a2e3-a90f6e5d8f5f",
"slackProfileDetails": [],
"jobTitle": "Individual Contributor",
"id": "5b4b8fa9-313c-449c-914d-5ab961105aaa",
"status": "ACTIVE",
"email": "[email protected]",
"profilePicUrl": "https://pp.getguru.com/2217c55f124f495a8910aef02b644be6.png",
"userProfile": {
"roleLevel": "Individual Contributor",
"useCaseList": [],
"role": "Enablement"
},
"lastName": "Beddia",
"firstName": "Joe"
}Then update the user's profile. Pass the response from the call above as the request body, replacing the profilePicUrl value with the uploadedPictureUrl from Step 2:
curl -X PUT https://api.getguru.com/api/v1/people/USERID \
-u $GURU_USER:$GURU_TOKEN \
-H "Content-Type: application/json" \
-d '{
"pronouns": "",
"displayName": "Joe Beddia",
"manager": {
"displayName": "Joe Duffy Admin",
"userId": "f92b946e-b1e6-4ec9-adac-7e5c9ed9244e",
"id": "ef336cec-1de6-4960-a33f-def3625f8efb",
"email": "[email protected]",
"profilePicUrl": "https://pp.getguru.com/e4039970b78648df8b3f7cf997a94a06.png",
"lastName": "Duffy Admin",
"firstName": "Joe"
},
"userId": "8e20337e-f173-45bf-a2e3-a90f6e5d8f5f",
"slackProfileDetails": [],
"jobTitle": "Individual Contributor",
"id": "5b4b8fa9-313c-449c-914d-5ab961105aaa",
"status": "ACTIVE",
"email": "[email protected]",
"profilePicUrl": "https://pp.getguru.com/e4039932194jg3df8b3f7cf997a94a06.png",
"userProfile": {
"roleLevel": "Individual Contributor",
"useCaseList": [],
"role": "Enablement"
},
"lastName": "Beddia",
"firstName": "Joe"
}'Updated 9 days ago

