• Not Answered

Update Avatar REST APi Call v7.6

Hi all,

I want to update a user avatar via a REST Api call using http://telligent.com/community/developers/w/developer75/35142.update-user-avatar-rest-endpoint.aspx, however I am not clear of the format to send the byte[] parameter as in the Request. An exert from my .net code is:

public static bool AddAvatar(System.IO.Stream file, string userName)
{
var requestUrl = String.Concat(Configuration.ApiUrl, string.Format(Configuration.AvatarEndPoint, userName));

using (var ms = new MemoryStream())
{
file.CopyTo(ms);
var newAvatar = ms.ToArray();

var values = new NameValueCollection();
values["FileData"] = Encoding.UTF8.GetString(newAvatar, 0, newAvatar.Length);

However in the Community Exceptions log I get an error - Parameter is not valid.

Could someone advise what I am doing wrong.

Thanks in advance

Related