Pregunta

I want to grab a file (excel file) every week since the data in the excel file keep changing for example, excel file for taxi cabs information. It would keep changing on the website from where I am grabbing. Everything remains same except new data gets added ocasionally. I am building a app in C# and publishing it to the store that grabs that file and saves it. From that excel file, I am planning to create a api for example, getCabNames(), getCabNum() etc.

Since it will be an app already in the store, my code must be efficient enough to grab the file from the website and makes it auto-sync. On linux system on my local computer, I can have a script which 'wget ' and I can cron it but since this is a app on the store, I cant use it this way.

The problem is how do I retrieve file from the website every week or so and keep updating the file so its syncd. This the website: link The file is at the bottom of the link called Taxicab Stand Locations (Excel)

What would be the most efficient way of doing this? Thanks.

¿Fue útil?

Solución

sounds like you need to make the data in excel available to your app via some sort of a web service, but you already know that since you are planning to create an API. if you know c#, look into asp.net mvc web api and create a controller which reads the excel file stored on the server and returns its data in a format your app will understand..

here's an example of how to build a web service using asp.net mvc web api

http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations

Otros consejos

You can't count on the app running at any given time. You could date the last time the app downloaded a file, and then check for a new one after a week's up, but that could be unreliable. You should be a web service that runs all the time and archives the file for the app to download when convenient. You could then make a cron job to query the service to download and archive the file.

Using Timer or something? Make it a windows service.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top