Problem Description
The CreateAvatarAsync method returns an error:
{
“type”: “BadRequestError”,
“status”: 400,
“message”: “Bad Request”,
“data”: {
“body”: [
{
“instancePath”: “/data/bodyType”,
“schemaPath”: “#/properties/data/properties/bodyType/enum”,
“keyword”: “enum”,
“params”: {
“allowedValues”: [“fullbody”, “fullbody-xr”, “halfbody”, “nova”]
},
“message”: “must be equal to one of the allowed values”,
“schema”: [“fullbody”, “fullbody-xr”, “halfbody”, “nova”],
“parentSchema”: {
“enum”: [“fullbody”, “fullbody-xr”, “halfbody”, “nova”]
},
“data”: “fullbodyxr”
}
]
}
}
Context
I am using CoreSettingsHandler.CoreSettings.BodyType to fill the bodyType property.
POST Request Body
{
“data”: {
“id”: “”,
“partner”: “meetingnow”,
“bodyType”: “fullbodyxr”,
“assets”: {},
“base64Image”: “iVBORw0KGgoAAAANSUhEUgAAAUAAAADwCAYAAABxLb1rAAAgAElEQVR4Aay9a5Nkx5Gml3XtbgDdaADkcJaztDFbaWQayUwm”
…
…
}
}
Bug Details
The BodyType enum contains “FullBodyXR” after serialize data, but the API requires “FullBody-XR”.
Thank you.
Thierry
Hello there!
“allowedValues”: [“fullbody”, “fullbody-xr”, “halfbody”, “nova”]
},
“message”: “must be equal to one of the allowed values”,
“partner”: “meetingnow”,
“bodyType”: “fullbodyxr”,
You’re passing the parameter fullbodyxr, when it should be fullbody-xr.
Also, please remember to set that same body type in your subdomain at your Studio account, otherwise it might cause conflicts and return errors.
hello,
I’m using the BodyType enumeration from the RPM Core SDK, but when you serialize your enumeration, you just turn it into lowercase, which gives “fullbodyxr”
Are you missing this annotation?
[JsonProperty(“fullbody-xr”)] in the public enum class BodyType
I use RPM 7.2 for Unity
namespace ReadyPlayerMe.Core
{
///
/// This enumeration describes the body type of the avatar.
///
public enum BodyType
{
None,
[Description(“fullbody”)] FullBody,
[Description(“halfbody”)] HalfBody,
[Description(“fullbody-xr”)] FullBodyXR
}
CreateNewAvatar(AvatarProperties avatarProperties) (from AvatarAPIRequest.cs is Code SDK) use Payload = avatarProperties.ToJson(true) en serialise BodyType with the name of Enum
(I put “full body” back in the subdomain while the full body xr avatar creation does not work.)
Thierry
I use :
var avatarResponse = await _avatarManager.CreateAvatarAsync(_avatarProperties);
_avatarProperties contain :
var bytes = texture.EncodeToPNG();
_avatarProperties = new AvatarProperties
{
Id = string.Empty,
Base64Image = Convert.ToBase64String(bytes),
Partner = CoreSettingsHandler.CoreSettings.Subdomain,
BodyType = BodyType.FullBodyXR,
Gender = OutfitGender.None,
isDraft = false
};
I have error :
{“type”:“BadRequestError”,“status”:400,“message”:“Bad Request”,“data”:{“body”:[{“instancePath”:“/data/bodyType”,“schemaPath”:“#/properties/data/properties/bodyType/enum”,“keyword”:“enum”,“params”:{“allowedValues”:[“fullbody”,“fullbody-xr”,“halfbody”,“nova”]},“message”:“must be equal to one of the allowed values”,“schema”:[“fullbody”,“fullbody-xr”,“halfbody”,“nova”],“parentSchema”:{“enum”:[“fullbody”,“fullbody-xr”,“halfbody”,“nova”]},“data”:“fullbodyxr”}]}}
In rpm sdk can you serialise Enum BodyType.FullBodyXR to “fullbody-xr” ?
( [JsonProperty(“fullbody-xr”)] ???)
Wrong message, is not for this bug !
I have problem with enum, not with assembly name
CreateAvatarAsync with FullBodyXR from Base64 image return error