REST Get Child Image V1 - 2015/03

The REST call Get Child Image 2015/03 provides the most recent image of a child based on an active child key. The image is formatted to input specifications. The date that the image was stored in GMC Compass is also provided.

The service returns JSON as default. The service will also return XML. This is controlled by the Accept parameter in the Message Header (i.e., for XML, it should be "Accept: application/xml" and for JSON, it should be "Accept: application/json").

Customers can manipulate the following parameters:

  • File type (.jpeg, .gif or .bmp)
  • Width and height
  • Resolution
  • Quality

 

There are three parameters to use to get the required type of picture:

  • DPI (dots per inch)
  • Height (pixels)
  • Width (pixels)

 

A website example would be DPI=72, Height=400, Width=300.

A print example would be DPI=300, Height= (desired inches high x DPI), Width= (desired inches wide x DPI). A print picture of 4 inches high by 3 inches wide the settings would be:

  • DPI=300
  • Height=1200
  • Width=900

 

If you need a higher DPI, adjust the height and width accordingly, keeping in mind that the bigger the picture the bigger the payload and slower the response time.

Sample Requests
Request Parameters
Response Parameters
XML Sample Successful Response
JSON Sample Successful Response
Sample Unsuccessful Response
Error Response Codes

Sample Request

This is an example only.

IPTest: https://api2.compassion.com/iptest/ci/v1/children/{childkey}/image/2015/03?api_key=[string]

Production: https://api2.compassion.com/ci/v1/children/{childkey}/image/2015/03?api_key=[string]

Request Parameters

Name Description Required Data Type Constraints
ChildKey Code assigned by Compassion International when the child is registered in the Child Sponsorship Program or the Leadership Development Program. Yes Sting Fixed 9
Height Image height in pixels Optional Numeric Default 600
Value between 1 and 5000 inclusive
Width Image width in pixels Optional Numeric Default 400
Value between 1 and 5000 inclusive
DPI Image dots per inch Optional Numeric Default 72
Value between 1 and 1200 inclusive
Quality Image quality (a lower number is poorer quality) Optional Numeric Default 100
Value between 1 and 100 inclusive
ImageFormat Type of image format Optional string Default jpeg
Valid Values jpeg | bmp | gif
ImageType Type of image that can be returned Optional string Default Headshot
Valid Values Headshot | Portrait | Fullshot | Raw
ClientReferenceId Uniquely represents the transaction in the client's system. Optional String Max 100
api_key Your Mashery supplied key for an application running Compassion International services. Yes String  

Response Parameters

Name Description Date Type Returned
EntityKey Same value that was in the Childkey in the request. string
ImageFormat Image format chosen by the customer or the default (jpeg) if the Image Format was not included in the input. string
ImageType Image Type chosen by the customer or the default (headshot) if Image Type was not included in the input. string
HasImage   boolean
Width Width chosen by the customer. This field is not included if the width was not included in the input number
Height Height chosen by the customer. This field is not included if the height was not included in the input. number
DPI DPI chosen by the customer. This field is not included if the DPI was not included in the input. number
Quality Quality chosen by the customer. number
ImageData Child image data. string
The following 4 fields are returned only if ImageType = "Raw" These coordinates identify the child's head  
TopCoordinate Identifying the number of pixels from top of the image to the top left corner of the child's headshot number
LeftCoordinate Identifying the number of pixels from left side of the image to the top left corner of the child's headshot number
HeightCoordinate The height of the child's headshot number
WidthCoordinate The width of the child's headshot number
ImageDate The date the image was stored in GMCCompass database string

XML Sample Successful Response

<EntityImage xmlns="http://schemas.ci.org/ci/common/2011/05/">
   <EntityKey>aannnnnnn</EntityKey>
   <EntityType>CS</EntityType>
   <ImageType>Headshot</ImageType>
   <HasImage>true</HasImage>
   <Image DPI="[number]"Quality="[number]"ImageFormat="jpeg"Width="[number]"Height="[number]">
     <ImageData>[blob]</ImageData>
   </Image>

   <ImageDate>[YYYY-MM-DD]</ImageDate>
</EntityImage>

JSON Sample Successful Response

{
  "entityKey":"aannnnnnn",
  "entityType":"CS",
  "imageType":"Headshot",
  "hasImage":"true",
  "Image": {
    "dpi":[number],
    "quality":[number],
    "imageFormat":"jpeg",
    "width":[number],
    "height":[number],
    "imageData":"[blob]",
    },

   "imageDate":[YYYY-MM-DD]",
}

Sample Unsuccessful Responses

XML Unsuccessful Response
<Error
  <ID>[string]</ID
  <Message>Invalid Child key. Child key must be 2 alpha characters followed by 5-7 numeric characters.</Message>
</Error>

JSON Unsuccessful Response
{
  "error": {
   "id":"[string]"
   "message":"Invalid Child key. Child key must be 2 alpha characters followed by 5-7 numeric characters."
  }
}

Error Response Codes

The table below indicates the HTTP error response and HTTP Error messName.

 

HTTP Error Response HTTP Error MessName
HTTP 400 Service Parameter Failure
HTTP 401 Not Authenticated / Authorized for Service Data
HTTP 403 Not Authorized
HTTP 403 Account Inactive
HTTP 403 Over Queries Per Second Limit
HTTP 403 Over Rate Limit
HTTP 403 Unknown Referrer
HTTP 404 Requested Resource Not Found
HTTP 408 Request Timeout
HTTP 414 Request URI Too Long
HTTP 500 Internal Server Error
HTTP 502 Bad Gateway
HTTP 503 API Maintenance / Service Unavailable
HTTP 504 Gateway Timeout

0 Comments

New comments are not being accepted at this time.

Docs Navigation