Sign in | Sign up

API Call Syntax

Tagged:

Currently contains 6 posts

Avatar

August 04, 2018 21:00

shagee08

Does anyone know what the API Call syntax is? What’s the URL and where do the App ID and Key go in that URL?

Avatar

August 04, 2018 22:14

Shravani

Read the Doc carefully.
Follow the Swagger link mentioned in API doc.
https://trackapi.nutritionix.com/docs/#!/default/post_v2_natural_nutrients
App ID and Key must be sent in Header

Avatar

August 29, 2018 20:42

shagee08

Set in header where? That’s what I’m asking. Where in this sequence https://trackapi.nutritionix.com/docs/#!/default/post_v2_natural_nutrients does it go?

I’m just trying to figure out how to make a simple API call

Avatar

September 29, 2019 11:50

bethanybeachbum

have you tried this?
headers = {
‘x-app-id’: ‘insert your app-id here’,
‘x-app-key’: ‘insert your app-key here’,
‘x-remote-user-id’:‘0’,
‘content-type’: ‘application/json’,
‘accept’: ‘application/json’
}

Avatar

October 17, 2019 04:30

seanren

$.ajax({
‘async’: true,
‘crossDomain’: true,
‘url’: ‘https://trackapi.nutritionix.com/v2/natural/nutrients’,
‘method’: ‘POST’,
‘headers’: {
‘x-app-id’: ‘’,
’x-app-key’: ‘’,
’Content-Type’:‘application/x-www-form-urlencoded’
},
‘processData’: true,
“data”: {
“query”: “apple”,

}, success: function(response,text,xhr) { console.log(response); console.log(text) console.log(xhr) }, error:function (textstatus){ console.log(textstatus); } });

This is the Standard Calling API SYNTAX!

Avatar

November 01, 2019 12:49

allenind

Has anyone encountered this error? {message: Unexpected token ’ in JSON at position 0} this is what my call looks like :
Map<String, String> headers = {
“Content-Type”: “application/x-www-form-urlencoded”,
“x-app-id”: “5bfd8a84”,
“x-app-key”: “c3c528f3a0c68a05a7698da8c36e1d7d”,
“x-remote-user-id”: “0”
};
String query = ‘{chicken noodle soup}’;

Reply to thread