Let's say I want to write an (iPhone) app, which tells you if you are in manhattan or not. This query involves additional computation after a google map API call (and is of course just an example).My question is where would you do this additional computation?On the App itself or on an application server?And in latter case, how would you communicate with the server?Would a REST api be appropriate for such a scenario? Here one could post latitude and longitude and receive a boolean indicating if one is inside or outside of manhattan.
Where to do post-processing of API call when used in MobileApp
web applications;rest;ios;app
Of course this depends a lot on the actual job that needs to be done. But lets assume you need to find out if you are in Manhattan and you have queries google maps for the current location. From google maps I believe it is possible to get the city name as well, but assuming we only have GPS coordinates, we would need to make an additional API call or implement some logic on the phone. In this case you want the phone to handle all API calls, this API call can be a call to your own REST implementation, in that case you handle the am I in  Manhattan? query at the server side. But if it is easy enough to handle this job at the phone, with this example that is the case, you should do it at the phone.If you need to do work after receiving data from an API on the phone, it is best to perform this on a separate thread (that you have anyways during the internet request). After completely processing the data on the phone you can update the user interface accordingly.Nowadays it is better to give as much work to the phone, and only use the server for communication and data synchronization. This keeps the server load at a minimum and distributes the work to all devices, which makes your setup extremely scalable.If you query your server to do most of the job and you have a few million phone users, you will kill your bandwidth.In short: As long as the job is douable whitin reasonable time on the device, do it on the device. If it is too complex, memory or time wise, create a REST api and perform it on the server.