> How do I make an API?

How do I make an API?

Posted at: 2014-12-18 
The way you do this is by using PHP on the server, then opening a URL in the app.

As an example, say you want to add an email address to a mailing list (i.e. database on the server) in your app.

On the server, you'd have a PHP script; and opening it like this will add the address:

http://server.com/api.php ? action=addemail & address=example@mail.com & key=3455BE423

(added spaces for readability and to avoid YA cutting off the line)

First, the key is checked (on the off chance somebody else happens to guess your URL format). If that matches, the action is checked, and if it is == "addemail", the address parameter is added to the database.

Finally, the script will echo "done" or "failed".

In your app, compose the URL string, then use the appropriate commands to open the URL and receive the reply.

As for how to get a free server with PHP and mySQL capabilities... well.

For now you can test-drive everything on your own machine by installing xampp or mamp.

Going online is another matter; unless you want to shell out a few bucks per month, you can try biz.nf

Give a try with Python, there are a lot of tutorials on how to make an API

I'm trying to make an API for an iOS app that I'm working on that involves users taking polls. Do I have to make the API on a server, and where do I find a server I can sign up for to use and start writing my API? I need this API to be able to store responses for the polls and then send the results for that poll back to the user once they have voted for them. They will be multiple-choice polls. Also, do I have to create the poll on a website or a server first? I'm so lost lol