Amy S.

asked • 08/02/20

URGENT: Problems with API in C# ASP.NET Core

I am doing an ASP.NET Core Website and have to show the list of all countries with their travel advisory scores in a table. I can't display the data using a Travel Advisory API. Each country is a separate key and are different classes when I paste the JSON as classes.

How can I call each country's class (eg. AU) and display the data under the country using a loop? The problem is that there are too many countries so I hope to use a loop for this. As you can see in the code below, I can only show one country at a time as each country is a different class.


Basic API Endpoint: https://www.travel-advisory.info/api

Optional Parameter: https://www.travel-advisory.info/api?countrycode=AU

(restrict the result list to a single country)


My Code:

Model: https://controlc.com/da48a2be

Controller: https://controlc.com/51d938c7




Michael C.

Is there a requirement you can't use the Base API to get all the countries or you just can't figure out how to make that work?
Report

09/16/20

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.