Hi!
I’ve seen you have v2/avatars POST request.
May I use it for my project to generate avatar by photo w/o using iFrame and etc.?
Thanks in advance!
Hi!
I’ve seen you have v2/avatars POST request.
May I use it for my project to generate avatar by photo w/o using iFrame and etc.?
Thanks in advance!
Hi and welcome to the Forum
We don’t have official documentation on this out yet, but you can use the following POST request to achieve it:
{
"data": {
"userId": {rpmUserId}
"partner": "{theirSubdomain}",
"bodyType": "fullbody"
"base64Image: {base64EncodedSelfie},
"gender": {optionalGender},
"assets": {
"outfit": "{assetID}"
}
}
}
Please note that the POST will only create the avatar draft, to actually use the avatar you need to save it too, by using PUT [https://api.readyplayer.me/v2/avatars/{avatarId}
Hello, I have a probleme when I create an avatar from selfie.
I can create a draft avatar successfuly but when i try to save it with
PUT [[https://api.readyplayer.me/v2/avatars/{avatarId}]
i got :
{“type”:“InternalServerError”,“status”:500,“message”:“Internal Server Error”}
This is my function who try to save the avatar:
Blockquote
def save_avatar(token, avatar_id):
url = f"https://api.readyplayer.me/v2/avatars/{avatar_id}"
payload = {}
headers = {
'Authorization': f'Bearer {token}',
'X-API-KEY': os.getenv("RPM_API_KEY"),
'X-API-ID': os.getenv("RPM_API_ID"),
}
try:
import time
# time.sleep(5)
# print("DEBUG 0", url, headers, payload)
response = requests.request("PUT", url, headers=headers, data=payload)
print("DEBUG 1", response.text)
response.raise_for_status() # Vérifie si une erreur HTTP s'est produite
return 0
except Exception as e:
raise Exception(f"in saving avatar : {e}\nresponse:{response.text}")
Blockquote
I don’t understand because when I use the same function with an avatar id create from a template it works
Can you help me please ?