Calling/Testing Web APIs in iOS app - ios

I am currently making my first iOS app in Swift. My web developer has sent me APIs for making calls for each method in the MySQL database table.
How do I use these web APIs in my mobile app to access the database?
Do I need to create a REST API or can I call these APIs directly?
Thanks.

Well obviously the Database and API has to be running on a web server some where. Then from your iOS application you would just be calling a web url to fetch data. For example:
mydomain.com/api/v1/getUsers
Which should then ideally return results in Json or XML or some format. And you use your programming skills to display that data in application.

Related

ios app dynamically loads data from website made on opencart

I have a website made on opencart and now I want an ios app for my website which dynamically loads data from the website. their database should be integrated so that when a change is made to any one of them it should make changes on both website and application.
Does someone provide me that API??
I dont think there is an API like you wish. You have to develop an API gateway as a middleware between your mobile apps and OpenCart backend. And I think it’s a simple job since all your data already exists in OpenCart database.

Use Google Places nearbySearch function in iOS

In Web API, use the nearbySearch function will return the results nearby the specific coordinate.
But I cannot find a similar function in iOS SDK.
I think the worst way is using REST API likes
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=22.979468,112.544345&radius=100&key=API_KEY by Alamofire
But I have another problem, I don't know how to restrict my API key for iOS REST API only.
I tried to set it for iOS Application but it does not work.
Please give me some idea, thank you very much!
You cannot apply iOS app restriction on web service API key. The only supported restrictions for web services are IP address restrictions. This supposes that you are executing web service requests from your backend server and restrict an API key with IP address of your backend server.
In case of mobile iOS app that means you should create an intermediate server to execute web services and pass responses back to your app in order to protect an API key that you use with web service.
There is a feature request in the Google issue tracker to add nearby search as a part of Places API for iOS:
https://issuetracker.google.com/issues/35830334
Feel free to star this feature request to add your vote and subscribe to further notifications from Google.
Hope this resolves your doubt.

Mobile Azure service for iOS and Android

I am working on the project where my backend will be in Azure and it will be native iOS and Android application :
https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-ios-how-to-use-client-library
My question is :-
Does Azure provide the service where we don't have to create any webservices to transfer the data between mobile and database on server?
We can handle everything from mobile side ?
NO - and you don't want that. It opens up a massive security hole.
You have to create the App Service and then use Easy Tables. Once the table is created, you can use the model in the client code and just push changes to the service. It will automatically and dynamically change the model on the backend.

How to share data between Azure Mobile App and ASP.Net MVC Web App

How can I share data between an instance of an MVC Web App and an Mobile App client say Android.
From the App Service documentation it is stated that we can use "(For .NET) Leverage any feature of ASP.NET, including MVC"
Following the standard Azure Todo List tutorial, if I create an Azure App Service, add and publish an Android Client with the Todo List object. If I want to add another object say Student.cs that should be shared between an MVC Web app and the Android client.
Do I need to extend Student.cs from EntityData and scaffold an MVC
controller using the default TodoContext. If this is the option
should I use migration to update the App Service DB? Just publishing
this back to App Service did not work for me.
Do I need to create a new MVC app, and scaffold CRUD operations
directly against the Azure SQL database used by the App Service? If
this option how can the App service be notified of data changes?
Do I need to publish the MVC web as a Web API and bye pass the
Mobile App client SDK and instead call the API app directly from my
mobile client?
The goal is to do data entry in the web app and pull and display the data in the mobile app.
You can combine the Azure Mobile App and Azure Web App into one single entity. Your application has access to the OData v3 endpoints as https://{yoursite}.azurewebsites.net/table/{your-table} and your application can do regular AJAX REST calls from the client. In addition, Entity Framework is fully set up so you can access the tables directly using Entity Framework.
So, set up your entities with a base class on EntityData, then use those with Entity Framework as normal. Scaffold your mobile web API using the Azure Mobile Apps SDK TableController.

Connecting ASP.NET MVC webApp and window mobile/windows phone7 app

last year I made really simple blog system. it allows user to authorize, posting, commenting. Now I want to create windows mobile/wp7 application that can adding new posts to my blog. But I have no idea how should it work. Should my web app share some api for this or my phone app should just sending specified request to server? I'm interessting how do facebook phone apps work? How they pass data to fb etc.
It would be great if anyone knows book, tutorial or something about connecting web app and phone app. I rather need app architecture tutorials than codes.
PS I know I can just open phone browser and login on website but I want to do it for fun :)
One way of approaching this is create a few actions in your controllers to return data in a format that is friendly to a WP7 app, for example, return JSON rather than HTML.
In your WP7 app you will make HTTP requests to these actions and receive the data in JSON format. From there it's up to you to handle that information on the phone.
What is the back-end of the blog system? Almost any DB data can now be exposed out as an OData Service that can be consumed on a Windows Phone app & also provide CRUD operations. Is OData a possibility?
Check out these two posts for details:
http://www.silverlightshow.net/items/Producing-and-Consuming-OData-in-a-Silverlight-and-Windows-Phone-7-application.aspx
http://www.silverlightshow.net/items/Connecting-Azure-Windows-Phone-through-OData.aspx
The second one does talk about how a central data store can be shared between web & mobile apps.
Hope this helps!

Resources