ListFoodUserCodes

Summary: Provides a list of all User Codes for foods matching the criterion in the request.

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

Request Type: FoodUserCodesListRequest

  • FilterByFoodTypes (Optional)
    • FoodType[]
    • Indicates which types of foods are returned. If empty, all foods are returned.
  • FilterByPulbicationStates (Optional)
    • PublicationState[]
    • Indicates which foods with the given publication states are returned. If empty, only published foods are returned.
  • DataSourceFilter (Optional)
    • String[]
    • Indicates which sources (UserFoods / EshaFoods) to query from.
  • 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: FoodUserCodesListResponse

  • UserCodes
    • Type: String[]
    • The list of user codes obtained from the 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:FoodUserCodesListRequest>
         <gen:FilterByPublicationStates>
            <gen:PublicationState>Draft</gen:PublicationState>
            <gen:PublicationState>Published</gen:PublicationState>
         </gen:FilterByPublicationStates>
         <gen:FilterByFoodTypes>
            <gen:FoodType>Ingredient</gen:FoodType>
            <gen:FoodType>Recipe</gen:FoodType>
         </gen:FilterByFoodTypes>
         <gen:DataSourceFilter>
            <gen:DataSource>EshaFoods</gen:DataSource>
            <gen:DataSource>UserFoods</gen:DataSource>
         </gen:DataSourceFilter>
         <gen:StartIndex>1</gen:StartIndex>
         <gen:PageSize>3</gen:PageSize>
      </gen:FoodUserCodesListRequest>
   </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/listfoodusercodesresponse</a:Action>
   </s:Header>
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <FoodUserCodesListResponse xmlns="http://ns.esha.com/2013/genesisapi">
         <ResponseVersion>1.0.0.0</ResponseVersion>
         <Status>
            <StatusMessage>Ok</StatusMessage>
            <StatusCode>200</StatusCode>
         </Status>
         <UserCodes>
            <UserCode>CB Raisins</UserCode>
            <UserCode>CB Lemon Wedge</UserCode>
            <UserCode>1128 USDA Standard</UserCode>
         </UserCodes>
      </FoodUserCodesListResponse>
   </s:Body>
</s:Envelope>
REST Request
POST http://localhost:80/rest/FoodQueryService.svc/ListFoodUserCodes HTTP/1.1
Content-Type: text/plain
Host: localhost:80

request={"StartIndex":1, "PageSize":3, "FilterByPublicationStates":["Draft","Published"], "FilterByFoodTypes":["Ingredient", "Recipe"], "DataSourceFilter":["UserFoods", "EshaFoods"]}
REST Response
{
    "UserCodes": [
        "CB Raisins",
        "CB Lemon Wedge",
        "1128 USDA Standard"
    ],
    "Status": {
        "StatusMessage": 200,
        "StatusCode": 200,
        "StatusDetail": null
    },
    "ResponseVersion": {}
}