© 2018 Capita Business Services Ltd. All rights reserved.

Capita Education Software Solutions is a trading name of Capita Business Services Ltd. Our Registered office is 30 Berners Street, London, W1T 3LR and our registered number is 02299747. Further information about Capita plc can be found in our legal statement.

SIMS 8 - V3 - Photographs

SIMS 8 Image Service

Many partners have been awaiting the availability of photographs from SIMS primary and these can now be accessed.

Part #1 of the task is to get the URL from an appropriate information domain call such as Learner/V3/LearnerIdentifiers.

An update to this guidance is intended to show how a thumbnail image can be retrieved.

{
  "@odata.context": "https://seli00apm01.azure-api.net/ssli01/Learner/V3/$metadata#LearnerIdentifiers",
  "value": [
    {
      "ExternalID": "cf444476-267c-41c4-bfac-00255f6ab408",
      "Forename": "Elizibeth",
      "Surname": "Olsen",
      "GenderCategory": "Female",
      "AgeMonths": 82,
      "DoNotCommunicate": false,
      "OnRollState": "Current",
      "DateOfApplication": null,
      "Photograph": "https://seli00apm01.azure-api.net/ssli01/Image/v2/Learner.Photograph/cf444476-267c-41c4-bfac-00255f6ab408?OrganisationID=a8ab7ed2-6747-4433-a369-03ec37fae372",
      "CurrentYearGroup": {
        "Description": "Year  1",
        "ExternalID": "3399f81b-d426-4ebf-86c2-6f3fe70fca40",
        "Type": "PastoralGroup.Definition.YearGroup"
      },
      "CurrentPrimaryClass": {
        "Description": "2JB",
        "ExternalID": "d5b1f16b-66ad-492e-9557-82e402630af6",
        "Type": "PastoralGroup.Definition.PrimaryClass"
      },
      "CurrentHouse": null
    }
  ]
}

Extract the photo url and the exmplar code is in C# .Net Framework and shows the principles:

 


using System.Net.Http;
using System.Net.Http.Headers;
using System.Xml;
using System.IO;
using System.Drawing;

        public Image ExecuteGetImage(string BearerToken, HttpClient httpClient, string OCP_APIM_Key)
        {
            Image rc = null;
            try
            {
                var request = new HttpRequestMessage()
                {
                    RequestUri = new Uri(URL),
                    Method = HttpMethod.Get,
                };
                request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("image/png"));
                
                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", BearerToken);
                request.Headers.Add("Ocp-Apim-Subscription-Key", OCP_APIM_Key);
                var httpClientResponseTask = httpClient.SendAsync(request);
                httpClientResponseTask.Wait();
                var result = httpClientResponseTask.Result;
                var responseStreamTask = result.Content.ReadAsStreamAsync();
               rc = Image.FromStream(responseStreamTask.Result);
              
            }

            catch (Exception ex)
            {
                ErrorMessage = ex.Message;
            }
            return rc;
        }