Personal image

Feb 16, 2012 at 10:09 AM


How to retrieve the personal image from the healthvault using Java Library?

Thank you.

Feb 20, 2012 at 6:38 PM


The jaxb datatypes are all generated from HealthVault's xsd files, so binary data is attached to the Thing envelope instead of the specific Thing data classes.  You can find the binary data in a class called DataOther.

The personal-image is stored with type-id "a5294488-f865-4ce3-92fa-187cd3b58930". 

You also need to specifically request the DataOther section when you are expecting binary data to be attached to a thing.

ThingFilterSpec filter = new ThingFilterSpec();

ThingFormatSpec format = new ThingFormatSpec();

ThingRequestGroup group = new ThingRequestGroup();

GetThingsRequest info = new GetThingsRequest();

GetThingsResponse response = (GetThingsResponse)requestTemplate.makeRequest(info);

Thing thing = (Thing)response.getGroup().get(0).getThing().get(0);
DataOther data = thing.getDataOther();


Jul 17, 2012 at 1:36 PM
Edited Jul 17, 2012 at 4:52 PM

In case anyone is reading these older discussions, here are the steps required to get this working on android; just add a few lines to the code for the "Weighter" sample app as indicated below:

public static String getRawXml_n_BinaryData(Record record, String HV_TYPE) {
    SimpleRequestTemplate template = new SimpleRequestTemplate(

    String info = "<info>" +
    "<group max=\"25\">" +
        "<filter>" + 
            "<type-id>" + HV_TYPE + "</type-id>" + 
        "</filter><format>" + 
            "<section>core</section>" +
            "<section>blobpayload</section>" +
            "<xml/>" + 
            "<type-version-format>" + HV_TYPE + "</type-version-format>" +
            "<blob-payload-request>" +
                "<blob-format>" +
                    "<blob-format-spec>inline</blob-format-spec>" +
                "</blob-format>" +
            "</blob-payload-request>" +						
        "</format>" + 
    "</group>" +

    Request request = new Request();

(Note that you don't need to mess around with fancy imports or changing the method name; just use "3" for the method version)


Jul 19, 2012 at 2:08 PM
Edited Jul 19, 2012 at 5:34 PM

One question about updating the Personal Image on android:

Because the Personal Image is a singleton, changing the image file is not as simple as just using PutThings; the image blobpayload needs to be "surgically" updated, rather than attempting to replace the entire "thing".  One possible workaround is to do RemoveThings (using the value of the thing-id tag) followed by PutThings (v2).  This approach appears to have some success, but seems to be a bit of a hack -- does anyone a better way?  Thank you

Jul 19, 2012 at 9:22 PM


You should be able to update the personal image.  You need to specify the thing-id and version-stamp in the PutThings call to make it an update.


Sep 21, 2012 at 2:16 PM
Edited Sep 21, 2012 at 2:17 PM

For future readers of this thread, be sure the <thing-id> tag goes prior to <type-id> in your xml request