How to create my own Web API / Web Service

IMHO, AppEngine is a great choice, since there is virtually no need to setup/manage it. Also it comes prepackaged with powerful services like datastore, taskqueue, user auth, messaging, etc.. The biggest advantage for me is the Datastore, which is schemaless, so you don't have to constantly update/manage the schema as your app progresses.

The downside is that it has somewhat different programming model so developers from servlet+SQL background tend to struggle with it at first. Since you are new to this it shouldn't be a problem.

All my advices below are Java, as this is what I know. Hopefully others will post answers that present other platforms/languages.

To get this running you will need to:

  1. Setup a web service. Go with REST as this is the most common and easy to setup/use. I tried all major Java REST frameworks and ended up with Resteasy, because it just works and has IMHO the best documentation.

  2. Understand how GAE Datastore works. There are a few APIs to use the Datastore:

    a. Low-level is cumbersome as you need to use it's model classes (Entity) so you'll do a lot of copying between your objects and Entity objects returned by this API.

    b. JDO/JPA are java ORM standards, but they were created for SQL databases and are really shoehorned onto Datastore. I'd advise against using them, because they are just an additional layer on top of low-level and also just try to fool developers that Datastore is a SQL database.

    c. Objectify. This is a 3rd party OSS library, but the author is AFAIK supported by Google. It's a layer on top of low-level, but in a really natural way, so not to obscure Datastore features. I recommend using it.

  3. Authentication. You will want authentication. GAE supports OpenID/OAuth out of the box (just tick federated login option in command panel). Now the tricky part is to get this working with iPhone and other devices:

    a. Require user to enter Google credentials into your iPhone app. Some users are reluctant to do this (me for instance). In this case use iPhone OAuth client.

    b. Open an OpenID login web page in embedded browser: Authenticating with Stack Overflow programmatically