Add a profile photo for a user. Valid for Communifire version 5.2 and above.
POST https://myintranet.communifire.com/api/users/56/profile/image?FileName=windows.jpg
Send the byte stream of the image in the body.
True/false is returned as ResponseData.
{ "IsError":false, "ResponseMessage":"", "ResponseData":true }
Please Note The content type that you pass in the header of your request should be application/octet-stream.
public static void UpdateUserImage() { string filePath = @"C:\[FILENAME]"; string postData = filePath; string serviceUrl = "[CommunifireURL]/api/users/1/profile/image?filename=[FILENAME]"; // Create a new HttpRequest var myRequest = (System.Net.HttpWebRequest)WebRequest.Create(serviceUrl); myRequest.Method = "PUT"; // Set the content header type. Note: use "application/octet-stream" for file data myRequest.ContentType = "application/octet-stream"; // Add the API key myRequest.Headers.Add("Rest-Api-Key", "[APIKEY]"); // Add the data to be posted in the request stream if (postData != null) { byte[] fileDataInByte; fileDataInByte = File.ReadAllBytes(postData); //set request stream (Content) using (var requestStream = myRequest.GetRequestStream()) { requestStream.Write(fileDataInByte, 0, fileDataInByte.Length); } } // Post the request and get the response details using (var response = myRequest.GetResponse()) { if (response.ContentLength > 0) { using (var reader = new StreamReader(response.GetResponseStream())) { //check the results assuming XML is returned: note for JSON: use JSON stringfy string result = reader.ReadToEnd(); Console.Write(result); } } } }
Please add more entry to this documentation.
FYI - In our upcoming version that will be released in a few months, we retrieve the users image from AD.
Thanks Matt. Do you have an approximate month for that release?
The new version is in testing, my.axerosolutions.com is even on the new version. We are working out kinks, an official announcement should be made within the next few months.
Please enable JavaScript to use file uploader.
is requesting access to a wiki that you have locked: https://my.axerosolutions.com/spaces/5/communifire-documentation/wiki/view/5729/rest-api-add-user-image