-3

I am messing around with RapidAPI and i dont undertand the code they give.

Could someone give me a teardown? It says in order to access api i have to write the following code

Map<String, Argument> body = new HashMap<String, Argument>();

body.put("ParameterKey1", new Argument("data", "ParameterValue1"));
body.put("ParameterKey2", new Argument("data", "ParameterValue2"));

try { 
    Map<String, Object> response = connect.call("APIName", "FunctionName",  body);
if(response.get("success") != null) { }

what are parameter keys 1 and 2, the data, and the parameter values

edit1:this is the code snippet i want to use in android studio

HttpResponse<JsonNode> response = Unirest.get("https://spoonacular-recipe-
food-nutrition-v1.p.mashape.com/recipes/search?
diet=vegetarian&excludeIngredients=coconut&instructionsRequired=
false&intolerances=egg%2C+gluten&limitLicense=false&number=
10&offset=0&query=burger&type=main+course")
.header("X-Mashape-Key", 
"Xxxxxx")
.header("X-Mashape-Host", "spoonacular-recipe-food-nutrition-
v1.p.mashape.com")
.asJson();
Grokify
  • 15,092
  • 6
  • 60
  • 81

1 Answers1

0

Your example code is using this https://github.com/zeeshanejaz/unirest-android. If you want to use that snippet you could start with that.

Jojo Narte
  • 2,767
  • 2
  • 30
  • 52