Make your product
work with UP.

Meals

Get the user's meal list

Returns the list of meals of the current user. This list can be paginated by date or timestamp.
URI Method Response Type Returns
/nudge/api/users/@me/meals GET application/json Collection>Meal
Parameter Type Description
date int Date, formatted as YYYYMMDD. If omitted, returns the information for today.
page_token int Timestamp used to paginate the list of meals. The Developer must use the "next" link provided in the "links" section.
start_time int To be used along with end_time. Epoch timestamp that denotes the start of the time range queried for events.
end_time int To be used with start_time. Epoch timestamp that denotes the end of the time range queried for events.
updated_after int Epoch timestamp to list events that are updated later than the timestamp. To be used with start_time to list events that were completed after said start_time.

Example:

GET https://jawbone.com/nudge/api/v.1.0/users/@me/meals?start_time=1383289200 HTTP/1.1
Host: jawbone.com
	

Will return:

HTTP 200 Ok
{
   “meta”:
   {
      “user_xid”: “6xl39CsoVp2KirfHwVq_Fx”,
      “message”: “OK”,
      “code”: 200
      "time": 1386122022
   },
   “data”:
   {
      "items": 
      [{
         "xid": "40F7_htRRnT8Vo7nRBZO1X",
         "title": "Something Good",
         "note": "Something Good",
         "type": "meal",
         "sub_type": 2,
         "time_created": 1384963500,
         "time_updated": 1385049599,
         "time_completed": 1385099220,
         "date": 20131121,
         "place_lat": "37.451572",
         "place_lon": "-122.184435",
         "place_acc": 10,
         "place_name": "Good Eats",
         "details": 
         {
            "num_drinks": 1, 
            "num_foods": 2, 
            "fiber": 0,
            "polyunsaturated_fat": 1.54,
            "potassium": 164.0, 
            "fat": 23.15, 
            "carbohydrate": 64.75, 
            "saturated_fat": 6, 
            "protein": 16.77, 
            "monounsaturated_fat": 5.773, 
            "sodium": 504.0, 
            "vitamin_c": 0, 
            "vitamin_a": 3.0, 
            "calories": 530.0, 
            "unsaturated_fat": 15.313, 
            "sugar": 19.0, 
            "calcium": 140.0, 
            "iron": 14.0, 
            "cholesterol": 50.0, 
            "accuracy": 20.0
            "tz": "America/Los_Angeles",
         }
      },
      {
      ... more items ....
      }],
      "links": 
      {
         "next": "/nudge/api/v.1.0/users/6xl39CsoVp2KirfHwVq_Fx/meals?page_token=1384390680"
      },
      “size”: 10
   }   
}
	
Data Value Type Description
xid string Unique ID for this event. Can be used to retrieve data for this specific event, see below.
title string Title of this meal
note string Note on this meal
type string Type of event, in this case a meal.
sub_type int Meal type. 1=Breakfast, 2=Lunch, 3=Dinner
time_created int Epoch timestamp when this meal was created.
time_updated int Epoch timestamp when this meal was last updated.
time_completed int Epoch timestamp when this meal was completed.
date int Date when this meal was created, formatted as YYYYMMDD.
place_lat float Latitude of location where meal was logged.
place_lon float Longitude of location where meal was logged.
place_acc int Accuracy of location where meal was logged, in meters.
place_name string Name of location where meal was logged.
num_drinks int Number of drinks in this meal.
num_foods int Number of foods in this meal.
fiber float Fiber content (in grams)
polyunsaturated_fat float Polyunsaturated fat content (in grams)
potassium float Potassium content (in milligrams)
fat float Fat content (in grams)
Carbohydrate float Carbohydrate content (in grams)
saturated_fat float Saturated fat content (in grams)
protein float Protein content (in grams)
monounsaturated_fat float Monosaturated fat content (in grams)
sodium float Sodium content (in milligrams)
vitamin_c float Percentage of daily recommended vitamin C (based on a 2000 calorie diet)
vitamin_a float Percentage of daily recommended vitamin A (based on a 2000 calorie diet)
calories int Calories for this meal.
unsaturated_fat float Unsaturated fat content (in grams)
sugar float Sugar content (in grams)
calcium float Calcium content (in milligrams)
iron float Percentage of daily recommended iron (based on a 2000 calorie diet)
cholesterol float Cholesterol content (in milligrams)
tz string Time zone when this meal was consumed, Olson format.
size int Number of items in this list.
next URI Link to next page of data (relative, add https://jawbone.com as prefix).

Get information about a specific meal

Returns detailed information about a specific meal
URI Method Response Type Returns
/nudge/api/meals/{xid} GET application/json Meal

Example:

GET https://jawbone.com/nudge/api/v.1.0/meals/40F7_htRRnT8Vo7nRBZO1X HTTP/1.1
Host: jawbone.com
	

Will return:

HTTP 200 Ok
{
   “meta”:
   {
      “user_xid”: “6xl39CsoVp2KirfHwVq_Fx”,
      “message”: “OK”,
      “code”: 200
      "time": 1386122022
   },
   “data”:
   {
      "xid": "40F7_htRRnT8Vo7nRBZO1X",
      "title": "Something Good",
      "note": "Something Good",
      "type": "meal",
      "sub_type": 2,
      "time_created": 1384963500,
      "time_updated": 1385049599,
      "time_completed": 1385099220,
      "date": 20131121,
      "place_lat": "37.451572",
      "place_lon": "-122.184435",
      "place_acc": 10,
      "place_name": "Good Eats",
      "details": 
      {
         "num_drinks": 1, 
         "num_foods": 2, 
         "fiber": 0,
         "polyunsaturated_fat": 1.54,
         "potassium": 164.0, 
         "fat": 23.15, 
         "carbohydrate": 64.75, 
         "saturated_fat": 6, 
         "protein": 16.77, 
         "monounsaturated_fat": 5.773, 
         "sodium": 504.0, 
         "vitamin_c": 0, 
         "vitamin_a": 3.0, 
         "calories": 530.0, 
         "unsaturated_fat": 15.313, 
         "sugar": 19.0, 
         "calcium": 140.0, 
         "iron": 14.0, 
         "cholesterol": 50.0, 
         "accuracy": 20.0
         "tz": "America/Los_Angeles",
      },
      "items":
      {
         "items": 
         [[
            "xid": "wl8xlA1QGj4K332_tfM7gw",
            "food_xid": "RR-CZ6PGN0M",
            "serving_xid": "3gjtdd2Q7pg",
            "name": "Cheeseburger",
            "description": "",
            "image": "/nudge/image/d/514933b4ed47ab657766c82d_image.jpeg",
            "sub_type": 2,
            "health_score": "", 
            "multiplier_max": 5,
            "multiplier_min": 0.1,
            "measurement": "sandwich",
            "type": "plate",
            "carbohydrate": 31.75,
            "trans_fat": 0,
            "saturated_fat": 6,
            "protein": 14.77,
            "sodium": 500,
            "vitamin_c": 0,
            "vitamin_a": 3,
            "unsaturated_fat": 7.313,
            "sugar": 0,
            "fiber": 0,
            "potassium": 164,
            "fat": 15.15,
            "monounsaturated_fat": 5.773,
            "calories": 319,
            "polyunsaturated_fat": 1.54,
            "calcium": 140,
            "iron": 14,
            "cholesterol": 50,
            "amount": 1
         },{
            ... more items ...
         }],
         "size": 3
      }
   }   
}
	

Create a new meal

URI Method Response Type Returns
/nudge/api/users/@me/meals POST application/json Meal
Parameter Type Description
title string Name of the meal
note string Description of the meal
image_url URI URI of the meal image
photo binary Binary contents of the meal image
place_lat float Latitude of the location where the meal was created
place_lon float Longitude of the location where the meal was created
place_acc float Accuracy (meters) of the location where the meal was created
place_name string Name of the location where the meal was created
time_created int Epoch timestamp when the meal was created
tz string Time zone where the meal was created
items JSON-encoded list See list below
Item property Type Description
name string Name of the meal item
description string Description of the meal item
amount float Amount of "measurement" (e.g. 100)
measurement String Unit of measurement (e.g. grams)
type int Type of plate (1-plate, 2-cup, 3-bowl, 4-scale, 5-glass)
category string Category name (free text)
food_type int 1-generic, 2-restaurant, 3-brand, 4-personal
calcium int Calcium (in milligrams)
calories int Calories
carbohydrate float Carbohydrate content (in grams)
cholesterol float Cholesterol content (in milligrams)
fiber float Fiber content (in grams)
protein float Protein content (in grams)
saturated_fat float Saturated fat content (in grams)
sodium float Sodium content (in milligrams)
sugar float Sugar content (in grams)
unsaturated_fat float Unsaturated fat content (in grams)

Example:

POST https://jawbone.com/nudge/api/v.1.0/users/@me/meals HTTP/1.1
Host: jawbone.com 
Accept: application/json
Content-Type: multipart/form-data; boundary=9431149156168
--9431149156168
Content-Disposition: form-data; name="place_lat"
37.7726
--9431149156168
Content-Disposition: form-data; name="place_lon"
-122.4148
--9431149156168
	

Will return:

HTTP 201 Created
{
   “meta”:
   {
      “user_xid”: “6xl39CsoVp2KirfHwVq_Fx”,
      “message”: “OK”,
      “code”: 200
      "time": 1386122022
   },
   “data”:
   {
      "xid": "40F7_htRRnT8Vo7nRBZO1X",
      "title": "Something Good",
      "note": "Something Good",
      "type": "meal",
      "sub_type": 2,
      "time_created": 1384963500,
      "time_updated": 1385049599,
      "time_completed": 1385099220,
      "date": 20131121,
      "place_lat": "37.451572",
      "place_lon": "-122.184435",
      "place_acc": 10,
      "place_name": "Good Eats",
      "details": 
      {
         "num_drinks": 1, 
         "num_foods": 2, 
         "fiber": 0,
         "polyunsaturated_fat": 1.54,
         "potassium": 164.0, 
         "fat": 23.15, 
         "carbohydrate": 64.75, 
         "saturated_fat": 6, 
         "protein": 16.77, 
         "monounsaturated_fat": 5.773, 
         "sodium": 504.0, 
         "vitamin_c": 0, 
         "vitamin_a": 3.0, 
         "calories": 530.0, 
         "unsaturated_fat": 15.313, 
         "sugar": 19.0, 
         "calcium": 140.0, 
         "iron": 14.0, 
         "cholesterol": 50.0, 
         "accuracy": 20.0
         "tz": "America/Los_Angeles",
      }
   }   
}
	

Update a meal

URI Method Response Type Returns
/nudge/api/meals/{xid}/partialUpdate POST application/json Meal
Parameter Type Description
title string Name of the meal
note string Description of the meal
image_url URI URI of the meal image
photo binary Binary contents of the meal image
place_lat float Latitude of the location where the meal was created
place_lon float Longitude of the location where the meal was created
place_acc float Accuracy (meters) of the location where the meal was created
place_name string Name of the location where the meal was created
time_created int Unix timestamp when the meal was created
tz string Time zone where the meal was created
items JSON-encoded list See Item Property above

Example:

POST https://jawbone.com/nudge/api/v.1.0/meals/{xid}/partialUpdate HTTP/1.1
Host: jawbone.com
Accept: application/json
Content-Type: multipart/form-data; boundary=9431149156168
--9431149156168
Content-Disposition: form-data; name="place_lat"
37.7726
--9431149156168
Content-Disposition: form-data; name="place_lon"
-122.4148
--9431149156168
Content-Disposition: form-data; name="photo"; filename="MyFilename.jpg"
Content-Type: image/jpeg
file_content
--9431149156168--
	

Will return:

HTTP 200 OK
{
   “meta”:
   {
      “user_xid”: “6xl39CsoVp2KirfHwVq_Fx”,
      “message”: “OK”,
      “code”: 200
      "time": 1386122022
   },
   “data”:
   {
      "xid": "40F7_htRRnT8Vo7nRBZO1X",
      "title": "Something Good",
      "note": "Something Good",
      "type": "meal",
      "sub_type": 2,
      "time_created": 1384963500,
      "time_updated": 1385049599,
      "time_completed": 1385099220,
      "date": 20131121,
      "place_lat": "37.451572",
      "place_lon": "-122.184435",
      "place_acc": 10,
      "place_name": "Good Eats",
      "details": 
      {
         "num_drinks": 1, 
         "num_foods": 2, 
         "fiber": 0,
         "polyunsaturated_fat": 1.54,
         "potassium": 164.0, 
         "fat": 23.15, 
         "carbohydrate": 64.75, 
         "saturated_fat": 6, 
         "protein": 16.77, 
         "monounsaturated_fat": 5.773, 
         "sodium": 504.0, 
         "vitamin_c": 0, 
         "vitamin_a": 3.0, 
         "calories": 530.0, 
         "unsaturated_fat": 15.313, 
         "sugar": 19.0, 
         "calcium": 140.0, 
         "iron": 14.0, 
         "cholesterol": 50.0, 
         "accuracy": 20.0
         "tz": "America/Los_Angeles",
      }
   }   
}
	

Delete a single meal event.

Deletes an existing meal event. The event must have been created by the partner for this call to succeed.
URI Method Response Type Returns
/nudge/api/meals/{xid} DELETE application/json Status

Example:

DELETE https://jawbone.com/nudge/api/v.1.0/meals/0ac1wXjUAYQ HTTP/1.1
Host: jawbone.com
Content-Type: application/x-www-form-urlencoded
	

Will return:

HTTP 200 OK
{
    "meta": {
        "user_xid": "V6p0-s4-qIo",
        "message": "OK",
        "code": 200,
        "time": 1351121565
    },
    "data": {}
}