/
GetConversions

GetConversions

Summary: Retrieves the conversions collection for a food identified by the specified Usercode or FoodId value.

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

Request Type: FoodMetadataRequest

  • UserCode (Optional)
    • Type: String
    • The user code for the food Requested. If empty, the FoodId value is used.
  • FoodId (Optional)
    • Type: Guid
    • The value of the Id field on the food. If empty, the User Code value is used.

Response Type: FoodConversionResponse

  • Conversions
    • Type: ConversionDto[]
    • The requested conversions collection
  • Status
    • Type: exlx:ResultStatus
    • The ResultStatus of the given response
  • ResponseVersion
    • Type: exlx:XmlVersion


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:FoodMetadataRequest>
         <gen:UserCode>REC-123</gen:UserCode>
      </gen:FoodMetadataRequest>
   </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/getconversionsresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <FoodConversionsResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <Conversions>
            <Conversion xmlns="http://ns.esha.com/2013/exlx">
               <From>
                  <Quantity Type="Double">1</Quantity>
                  <UnitId>a7df0af5-001f-0000-7484-751e8eaf05c6</UnitId>
               </From>
               <ConversionFactor Type="Double">1</ConversionFactor>
               <To>
                  <Quantity Type="Double">100</Quantity>
                  <UnitId>a7df0af5-0008-0000-7484-751e8eaf05c6</UnitId>
               </To>
            </Conversion>
         </Conversions>
         <ResponseVersion>1.0.0.0</ResponseVersion>
         <Status>
            <StatusMessage>Ok</StatusMessage>
            <StatusCode>200</StatusCode>
         </Status>
      </FoodConversionsResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/FoodQueryService.svc/GetConversions HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"UserCode":"REC-123"}
REST Response
{
    "Conversions": [
        {
            "From": {
                "Quantity": {
                    "Value": "1",
                    "Type": 14
                },
                "UnitId": "a7df0af5-001f-0000-7484-751e8eaf05c6"
            },
            "ConversionFactor": {
                "Value": "1",
                "Type": 14
            },
            "To": {
                "Quantity": {
                    "Value": "100",
                    "Type": 14
                },
                "UnitId": "a7df0af5-0008-0000-7484-751e8eaf05c6"
            }
        }
    ],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}

Related content

GetFood
More like this
ListFoodUserCodes
ListFoodUserCodes
More like this
GetAnalysis
GetAnalysis
More like this
ListNutrients
ListNutrients
More like this
NewFood (4.0)
NewFood (4.0)
Read with this
GetFoodByUserCode
GetFoodByUserCode
More like this