code-for-chapel-hill / NC-COVID-Support

Community support site, supporting COVID-19 business opening hours, Food Banks, School Meals, Farms and Social Services.
https://nccovidsupport.org
GNU General Public License v3.0
16 stars 39 forks source link

Pull the resources map data from the API #263

Open MiguelLopez6 opened 4 years ago

MiguelLopez6 commented 4 years ago

Description of the new functionality Get the resources data from the API available at https://nccovid.vizioz.com/ to populate the data shown in the map.

What we need to code Create a REST API call to get the categories from https://nccovid.vizioz.com/api/v1/resource/getbycategory/{categoryId}

HTTP GET https://nccovid.vizioz.com/api/v1/resource/getbycategory/{categoryId}

Where {categoryId} is the id of the category we want to display data for. Use the data returned to populate the map resources.

The data returned is in JSON format, containing a list of all resources available.

Additional context

The documentation for the API can be found at https://github.com/Vizioz/CovidSupport/blob/master/documentation.md

readingdancer commented 4 years ago

One thing to keep in mind when working on this ticket is that currently the entire dataset is being downloaded when the page first loads, when we implement this change, this will need to be re-coded so that the API is called each time the user selects a different category.

It would of course be good to cache these calls on the client, I think we will add this in a future iterative change.

readingdancer commented 4 years ago

This issue is linked to: https://github.com/code-for-chapel-hill/NC-COVID-Support/issues/262 which needs to be implemented first for you to get the right ID's to request the data :)

readingdancer commented 4 years ago

Please add the API URL to the /themes/theme.config.js file so that it is configurable per site.