SpyREST

Supported by Mashape

Home » api.nutritionix.com Versions » v1_1 Resources » search » POST /v1_1/search

POST /v1_1/search

Description

Custom content

#NQL

Items

Response Fields

Name Type Description
total Integer
max_score Float
hits Array
hits[]._index String
hits[]._type String
hits[]._id String
hits[]._score Float
hits[].fields.item_id String
hits[].fields.item_name String
hits[].fields.brand_name String
Write
Preview

Examples

Filter all but restaurants
Filter for packaged items
Search all items

Filter all but restaurants

Recorded at

2015-11-03 23:20:47 UTC

Try with cURL

Request URL

POST /v1_1/search      

Request Headers

content-length: 115
content-type: application/json
accept: */*
user-agent: curl/7.37.1
      

Request Body

{"appId":"27bea288","appKey":"20e7dbd58d07239743c441a2488f3cbb","query":"Coffee","filters":{"not":{"item_type":2}}}
      

Response Headers

transfer-encoding: chunked
connection: close
content-length: 2192
x-powered-by: Express, Phusion Passenger
status: 200 OK
set-cookie: ["session=-QTY1xEfgKFzejzBnT5kOw.3g32oICc5OvcdGlfT6S7mq-YT3O9jOQiyIl7G4RtjFk.1446592837604.86400000.h6tlY1qZTpt82edqWlRMqo0vFY7W3hFcHFnn-n7rDZs; path=/; expires=Thu, 03 Dec 2015 23:20:37 GMT"]
server: nginx/1.6.2 + Phusion Passenger
etag: "351462052"
date: Tue, 03 Nov 2015 23:20:37 GMT
content-type: application/json; charset=utf-8
access-control-allow-origin: *
access-control-allow-methods: GET, PUT, POST, DELETE, OPTIONS
access-control-allow-headers: Content-Type, X-Requested-With, X-APP-ID, X-APP-KEY
      

Response Body

Shortened for readability

{
  "total": 3546,
  "max_score": 12.443592,
  "hits": [
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "513fceb675b8dbbc21001e29",
      "_score": 12.443592,
      "fields": {
        "item_id": "513fceb675b8dbbc21001e29",
        "item_name": "Coffee - 1 tsp",
        "brand_name": "USDA"
      }
    },
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "513fceb675b8dbbc21001e28",
      "_score": 12.180759,
      "fields": {
        "item_id": "513fceb675b8dbbc21001e28",
        "item_name": "Coffee - 1 packet",
        "brand_name": "USDA"
      }
    }
  ]
}
      

Filter for packaged items

Recorded at

2015-11-03 23:17:59 UTC

Try with cURL

Request URL

POST /v1_1/search      

Request Headers

content-length: 107
content-type: application/json
accept: */*
user-agent: curl/7.37.1
      

Request Body

{"appId":"27bea288","appKey":"20e7dbd58d07239743c441a2488f3cbb","query":"Coffee","filters":{"item_type":2}}
      

Response Headers

transfer-encoding: chunked
connection: close
content-length: 2193
x-powered-by: Express, Phusion Passenger
status: 200 OK
set-cookie: ["session=euDkVeyE8wSaWnuhpCXzTw.ZdcgmSvANWzrabeE_PDlmvTjIyXi1UXuhXiPsOEcsPo.1446592698798.86400000.z7dq75AX6B_T3mVmDhnuxQHSs5p_fBRmf_3-yMOtNVM; path=/; expires=Thu, 03 Dec 2015 23:18:18 GMT"]
server: nginx/1.6.2 + Phusion Passenger
etag: "597681200"
date: Tue, 03 Nov 2015 23:18:18 GMT
content-type: application/json; charset=utf-8
access-control-allow-origin: *
access-control-allow-methods: GET, PUT, POST, DELETE, OPTIONS
access-control-allow-headers: Content-Type, X-Requested-With, X-APP-ID, X-APP-KEY
      

Response Body

Shortened for readability

{
  "total": 3979,
  "max_score": 3.3344562,
  "hits": [
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "552bc3d90ab300ad64cc066f",
      "_score": 3.3344562,
      "fields": {
        "item_id": "552bc3d90ab300ad64cc066f",
        "item_name": "Coffee",
        "brand_name": "Arruda's"
      }
    },
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "528cb2f8cefcc7974c0005ad",
      "_score": 3.3344562,
      "fields": {
        "item_id": "528cb2f8cefcc7974c0005ad",
        "item_name": "Coffee",
        "brand_name": "Splenda"
      }
    }
  ]
}
      

Search all items

Recorded at

2015-11-03 23:15:39 UTC

Try with cURL

Request URL

POST /v1_1/search      

Request Headers

content-length: 81
content-type: application/json
accept: */*
user-agent: curl/7.37.1
      

Request Body

{"appId":"27bea288","appKey":"20e7dbd58d07239743c441a2488f3cbb","query":"Coffee"}
      

Response Headers

transfer-encoding: chunked
connection: close
content-length: 2177
x-powered-by: Express, Phusion Passenger
status: 200 OK
set-cookie: ["session=t3WgYScrY-eJJCy2BDmVuA.JNp8_o5qzNuwAIAc_WSftJV9WKGoW-fZn0mLD-7-O9o.1446592546406.86400000.AozIKjcf0k0T7LPdlQr3Lv9Rzq-V-9KSx8OYtgar7sQ; path=/; expires=Thu, 03 Dec 2015 23:15:46 GMT"]
server: nginx/1.6.2 + Phusion Passenger
etag: "-812740012"
date: Tue, 03 Nov 2015 23:15:46 GMT
content-type: application/json; charset=utf-8
access-control-allow-origin: *
access-control-allow-methods: GET, PUT, POST, DELETE, OPTIONS
access-control-allow-headers: Content-Type, X-Requested-With, X-APP-ID, X-APP-KEY
      

Response Body

Shortened for readability

{
  "total": 7494,
  "max_score": 12.207488,
  "hits": [
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "513fceb675b8dbbc21001e29",
      "_score": 12.207488,
      "fields": {
        "item_id": "513fceb675b8dbbc21001e29",
        "item_name": "Coffee - 1 tsp",
        "brand_name": "USDA"
      }
    },
    {
      "_index": "f762ef22-e660-434f-9071-a10ea6691c27",
      "_type": "item",
      "_id": "513fceb675b8dbbc21001e28",
      "_score": 12.133621,
      "fields": {
        "item_id": "513fceb675b8dbbc21001e28",
        "item_name": "Coffee - 1 packet",
        "brand_name": "USDA"
      }
    }
  ]
}