ListUnits

Summary: Provides a list of all units available which nutrients can be measured.

Soap Action: http://ns.esha.com/2013/genesisapi/ListUnits

Request Type: UnitListRequest

  • StartIndex (Optional)
    • Type: Int
    • The index offset. If empty, index starts at 1.
  • PageSize (Optional)
    • Type: Int
    • The number of foods to return in the response. If empty, all records are returned.

Response Type: UnitListResponse

  • Units
    • Type: UnitDto[]
    • List of units obtained from the given request.
  • Status
    • Type: exlx:ResultStatus
    • The ResultStatus of the given response
  • ResponseVersion
    • Type: exlx:XmlVersion
    • The version of the given response.


SOAP Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:gen="http://ns.esha.com/2013/genesisapi">
   <soap:Header/>
   <soap:Body>
      <gen:UnitListRequest>
         <gen:StartIndex>1</gen:StartIndex>
         <gen:PageSize>3</gen:PageSize>
      </gen:UnitListRequest>
   </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/listunitsresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <UnitListResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <ResponseVersion>1.0.0.0</ResponseVersion>
         <Status>
            <StatusMessage>Ok</StatusMessage>
            <StatusCode>200</StatusCode>
         </Status>
         <Units>
            <Unit>
               <Id xmlns="http://ns.esha.com/2013/exlx">a7df0af5-0001-0000-7484-751e8eaf05c6</Id>
               <Dimension xmlns="http://ns.esha.com/2013/exlx">Volume</Dimension>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Teaspoon</Value>
               </Name>
               <Abbreviation xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">tsp</Value>
               </Abbreviation>
               <StandardKey xmlns="http://ns.esha.com/2013/exlx">Teaspoon</StandardKey>
            </Unit>
            <Unit>
               <Id xmlns="http://ns.esha.com/2013/exlx">a7df0af5-0002-0000-7484-751e8eaf05c6</Id>
               <Dimension xmlns="http://ns.esha.com/2013/exlx">Volume</Dimension>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Tablespoon</Value>
               </Name>
               <Abbreviation xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Tbs</Value>
               </Abbreviation>
               <StandardKey xmlns="http://ns.esha.com/2013/exlx">Tablespoon</StandardKey>
            </Unit>
            <Unit>
               <Id xmlns="http://ns.esha.com/2013/exlx">a7df0af5-0003-0000-7484-751e8eaf05c6</Id>
               <Dimension xmlns="http://ns.esha.com/2013/exlx">Volume</Dimension>
               <Name xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">Cup</Value>
               </Name>
               <Abbreviation xmlns="http://ns.esha.com/2013/exlx">
                  <Value xml:lang="en-US" xmlns="http://ns.esha.com/2013/types">cup</Value>
               </Abbreviation>
               <StandardKey xmlns="http://ns.esha.com/2013/exlx">Cup</StandardKey>
            </Unit>
         </Units>
      </UnitListResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/FoodQueryService.svc/ListUnits HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"StartIndex":1, "PageSize":3}
REST Response
{
    "Units": [
        {
            "Dimension": 1,
            "Name": {
                "en-US": "Teaspoon"
            },
            "Abbreviation": {
                "en-US": "tsp"
            },
            "StandardKey": 1,
            "StandardKeySpecified": true,
            "Id": "a7df0af5-0001-0000-7484-751e8eaf05c6",
            "IdSpecified": true
        },
        {
            "Dimension": 1,
            "Name": {
                "en-US": "Tablespoon"
            },
            "Abbreviation": {
                "en-US": "Tbs"
            },
            "StandardKey": 2,
            "StandardKeySpecified": true,
            "Id": "a7df0af5-0002-0000-7484-751e8eaf05c6",
            "IdSpecified": true
        },
        {
            "Dimension": 1,
            "Name": {
                "en-US": "Cup"
            },
            "Abbreviation": {
                "en-US": "cup"
            },
            "StandardKey": 3,
            "StandardKeySpecified": true,
            "Id": "a7df0af5-0003-0000-7484-751e8eaf05c6",
            "IdSpecified": true
        }
    ],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}