GetFormPhoto()

The GetFormPhoto() command returns a form photo.

Note: We only allow for the retrieval of one photo at a time. If you need multiple photos, you'll have to handle this your side by iterating through the API results from the GetFormAttachments call.
  • Quota: 6
Table 1. Parameters
ParameterTypeMax LengthRequiredDescription
apiToken string20Y Your API security token configured in Field View.
formId string20Y Supply the form Id the photo is attached to
mediaId string20Y The unique ID of the photo

Example SOAP Envelope Header

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="https://localhost.priority1.uk.net/Priority1WebServices/XML">
  <soap:Header/>
  <soap:Body>
     <ns:GetFormPhoto>
        <ns:apiToken>68DC485979B73FD1EF363AC292D9E41FBECF11D</ns:apiToken>
        <ns:formId>F1.32975</ns:formId>
        <ns:mediaId>1.57919</ns:mediaId>
     </ns:GetFormPhoto>
  </soap:Body>
</soap:Envelope>

Example SOAP Response

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
     <GetFormPhotoResponse xmlns="https://localhost.priority1.uk.net/Priority1WebServices/XML">
        <GetFormPhotoResult>
           <FormPhotoResponse xmlns="">
              <MediaId>1.57919</MediaId>
              <Media>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQ THIS COULD BE HUGE DEPENDING ON THE SIZE OF ATTACHMENT........</Media>
              <DateRecorded>2016-12-20T10:41:19.553</DateRecorded>
              <Status>
                 SUCCESS
                 <Message>Success.</Message>
              </Status>
           </FormPhotoResponse>
        </GetFormPhotoResult>
     </GetFormPhotoResponse>
  </soap:Body>
</soap:Envelope>

Recreating the document (C#)

Note: When an image is uploaded into Field View its always converted to a JPEG; therefore, we don't need to return the content type in order to know what file is returned.
var photo= [yourAPIcall...]
Response.Clear();
Response.ClearHeaders();
Response.ContentType = "image/jpeg";
Response.AddHeader("Content-Disposition", "attachment; filename=" + photo.MediaId + ".jpg");
Response.BinaryWrite(photo.Media);
Response.Flush();
Response.End();