Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Joseph Haddad
Joseph Haddad
16,246 Points

How do you create an API for an app you are developing?

I'm currently developing an iPhone application in Swift that will display information from restaurants in my area (prices, promos, etc...). However I'm not sure if it's even feasible to pull information from about 20 different websites onto one app. This is why I want to create an API. I want to be able to update the data myself from one database.

This is where my question lies. How do I create an API from scratch? From my research I see that I will need a host server (a service I will have to pay for) and knowledge of PHP.

Can I get some one else to construct an API for me for a reasonable price?

Am I approaching this problem the correct way?

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

An API would let other people use your data for their needs. Is that what you are intending to have? Or how are you intending to update this information?

Joseph Haddad
Joseph Haddad
16,246 Points

I don't want to provide a service for anyone yet. I want to the only one that can add/delete/update data in my iPhone app from my laptop if possible.

Kevin Korte
Kevin Korte
28,148 Points

Ah gotcha, I get what you're after. Let me say I am in no way a iOS developer, but I thought you could have an iOS app read from a JSON file? If that's true, you should be able to build yourself a little back end user interface, that updates your database, and than your iOS app makes request to specific URL's, which returns a JSON array of data, which you parse and display in the app.

If that's possible with iOS, that's probably the easiest way to go. To set that up, you would need a domain and a server that can handle the number of requests your users would throw at it. That number would be low at the start, so it should be that expensive.

For the back end, any server side language should work. PHP is just one of the options. I think that's the way I would research, but somebody might be able to offer a different angle at this.