Does anyone have experience using the APIs at https://market.mashape.com/spoonacular?
Does anyone have experience using the APIs at https://market.mashape.com/spoonacular?
I am trying to POST some data and use the Response.
They do not have a Pascal example. I think I have used Indy10 to post. However, all the POST examples show the URL with a "/dosomething.php" or something similar.
Then the HTTP component adds a "?name=value&one=two&" and so on for all the headers and data.
The API call I want to use does not have this, "http://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/visualizePriceEstimator"
When I send the request it sends ...Estimatorx-mashape-key=xxxxxx... The response is "missing key".
Can someone show me how to do this?
Win 10, Delphi XE7 Pro.
https://market.mashape.com/spoonacular/recipe-food-nutrition
I am trying to POST some data and use the Response.
They do not have a Pascal example. I think I have used Indy10 to post. However, all the POST examples show the URL with a "/dosomething.php" or something similar.
Then the HTTP component adds a "?name=value&one=two&" and so on for all the headers and data.
The API call I want to use does not have this, "http://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/visualizePriceEstimator"
When I send the request it sends ...Estimatorx-mashape-key=xxxxxx... The response is "missing key".
Can someone show me how to do this?
Win 10, Delphi XE7 Pro.
https://market.mashape.com/spoonacular/recipe-food-nutrition
The request from Fiddle seems that the URL string contains data from header. Could you show how your URL variable (constant) looks like?
ReplyDeletePOST can go out as a GET if a server receive the POST request redirect to other URL I guess. But indeed it is strange.
I think you should create the http request as follow:
ReplyDeleteURL := 'https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/visualizePriceEstimator';
Parameters := TStringList.Create;
Parameters.Add('defaultCss= true');
Parameters.Add('ingredientList=3 oz flour');
Parameters.Add('mode=1');
Parameters.Add('servings=2');
Parameters.Add('showBacklink=true');
IdHTTP.Request.CustomHeaders.AddValue('X-Mashape-Key','');
IdHTTP.Request.CustomHeaders.AddValue('Accept', 'text/html');
IdHTTP.Request.CustomHeaders.AddValue('Content-Type', 'application/x-www-form-urlencoded');
IdHttp1.Post(URL, Parameters, Response);
OK, this helped me. Thanks
ReplyDelete