Recipe - Food - Nutrition

फ्रीमियम
Verified
द्वारा David | अपडेट किया गया hace 21 días | Food
लोकप्रियता

9.9 / 10

लेटेंसी

504ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Unirest with Find Product by UPC

Rapid account: Water KH
WaterKH
hace 7 años

I’ve been working on this since I received the notification that the UPC lookup was ready. I’ve been trying to use Unirest to create the get request, but it’s not allowing me to parse the Json into a class. Can you maybe post the types associated with the Json? I have my class that I can post below. Thank you.

public class FindByUPC
{
public long id { get; set; }
public string title { get; set; }
public double? price { get; set; }
public int? likes { get; set; }
public List<string> badges { get; set; }
public List<string> important_badges { get; set; }
public string nutrition_widget { get; set; }
public string serving_size { get; set; }
public int number_of_servings { get; set; }
public int spoonacular_score { get; set; }
public List<string> breadcrumbs { get; set; }
public string generated_text { get; set; }
public double? ingredientCount { get; set; }
public List<string> images { get; set; }
}

Rapid account: Spoonacular
spoonacular Commented hace 7 años

I personally don’t use unirest so I can’t say much about what happens there. Maybe try making all optional (with “?”). What the API returns you can see here when you test the endpoint: https://market.mashape.com/spoonacular/recipe-food-nutrition#find-products-by-upc

Rapid account: Water KH
WaterKH Commented hace 7 años

I’m not entirely sure how to check this, my apologies. I do know the .asJson<FindByUPC>() code is the part that gives the error System.AggregrateException. Probably not a helpful error I assume though.

Rapid account: Spoonacular
spoonacular Commented hace 7 años

Which field throws an error for you? I cannot see an error in your class at a first glance.

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें