GetLabelImageForFood (4.0)

Summary: Provides a label a food provided in the request. This food will not be saved to the database.

Request Type: ImageForFoodRequest

  • Food
    • Type: FoodDto
    • The food you want a a label for. This is currently only supported for Recipes.
  • LabelProfile
    • Type: LabelProfileDto
    • The label profile that will determine what type of label will be returned.

Response Type: ImageResponse

  • Image
    • Type: Stream
    • The png encoded bitmap of the image.


SOAP Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:gen="http://ns.esha.com/2013/genesisapi" xmlns:exlx="http://ns.esha.com/2013/exlx" xmlns:typ="http://ns.esha.com/2013/types">
   <soap:Header/>
   <soap:Body>
      <gen:ImageForFoodRequest>
        <gen:LabelProfile>
            <exlx:Authority>
                <exlx:Id>BBF4846D-8400-43BB-944D-6021FDA98225</exlx:Id>
                <exlx:Regulation>U.S. 2016 NLEA</exlx:Regulation>
            </exlx:Authority>
            <exlx:LabelStyle>Standard</exlx:LabelStyle>
            <exlx:LabelFormat>Full</exlx:LabelFormat>
            <exlx:AlternateHeading>
                <typ:Value xml:lang="en-US">Sugar</typ:Value>
            </exlx:AlternateHeading>
            <exlx:ServingSize>
                <typ:Value xml:lang="en-US">1 scoop</typ:Value>
            </exlx:ServingSize>
            <exlx:ServingsPerContainer>
                <typ:Value xml:lang="en-US">1</typ:Value>
            </exlx:ServingsPerContainer>
        </gen:LabelProfile>
        <gen:Recipe>
            <exlx:Items>
                <exlx:FoodItem>
                    <!-- Add item to Recipe  -->
                    <exlx:FoodId>752eb9c2-0001-0000-bede-d3a51c0fdeba</exlx:FoodId>
                    <exlx:Amount>
                    	<exlx:Quantity Type="Double">100</exlx:Quantity>
                    	<exlx:UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</exlx:UnitId>
                    </exlx:Amount>
                </exlx:FoodItem>
            </exlx:Items>       
        </gen:Recipe>
      </gen:ImageForFoodRequest>
   </soap:Body>
</soap:Envelope>
SOAP Response
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
   <s:Header>
      <a:Action s:mustUnderstand="1">http://ns.esha.com/2013/genesisapi/getlabelimageforfoodresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ImageResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <Image>iVBORw0KGg...</Image>
      </ImageResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/LabelImageService.svc/GetLabelImageForFood HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={
	"Food":{
        "$type":"Esha.DomainModel.Serialization.RecipeDto, Esha.DomainModel.Serialization",
        "Items":[{
            "FoodId":"752eb9c2-0001-0000-bede-d3a51c0fdeba",
            "Amount":{
                "Quantity":{
                    "Value":"100","Type":"Double"
                },
                "UnitId":"a7df0af5-0008-0000-7484-751e8eaf05c6"}
        }]
    },
    "LabelProfile":{
        "Authority":{
            "Id":"BBF4846D-8400-43BB-944D-6021FDA98225",
            "Regulation":"U.S. 2016 NLEA"
        },
        "LabelStyle":"Standard",
        "LabelFormat":"Full",
        "AlternateHeading":{"en-US":"New Heading"},
        "ServingSize":{"en-US":"1"},
        "ServingsPerContainer":{"en-US":"1"}
    },
}}
REST Response
{
    "Image":"iVBORw0KGgoAAAANSUh..."
}