I have not been able to this with this API, but was able to do in using python:
import hashlib # to get the MD5 has functions
import urllib # to get the function for % encoding of the URL
...
baseUrl = 'https://xxx.instructure.com/api/v1/' # changed to your domain
gravatar_base_url='https://secure.gravatar.com/avatar/'
header = {'Authorization' : 'Bearer ' + access_token}
payload = {}
...
def insert_avatar_url(user_id, user_e_mail, url_to_avatar):
url = baseUrl + 'users/%s' %(user_id)
hashed_user_email=hashlib.md5(user_e_mail)
constructed_url=gravatar_base_url+hashed_user_email.hexdigest()+"?s=50&d="+urllib.quote(url_to_avatar, safe='')
payload = {'user[avatar][url]': constructed_url}
r = requests.put(url, headers = header, data = payload)
This successfully sets the URL as specified, which includes a default URL to the user's avatar (in case they do not actually have a gravatar avatar registered).
Chip