Layar Developer Documentation

Back to

Layer Service Provider

After registering a layer on the publishing site , the key to make a layer work is to set up a web service. This web service needs to communicate with the layar server and generate appropriate getPOIs response based on Layar Developer API . In this section, we will walk through the essential steps in setting up this web service.

What's needed?

The following elements are needed to in setting up the web service:

  1. A public web server (reachable via the internet) to host this web service.
  2. A database which can be used to store POI information and other data needed in the layer, such as sessions, usernames, passwords (if your layer lets users log in). This database should be hosted on a public web server as well, normally the same web server where the web service is hosted.

NOTE: web server hosted on localhost does not work, since the web service needs to communicate with Layar Server.

How to set up the connection with Layar Server ?

To get a general idea about the Layar platform, please check out Layar Platform Architecture Overview first. The general flow is as follows:

  1. Create a web service on a public web server
  2. While creating a layer on the publishing site, fill in "the API endpoint URL" field with the URL to the web service.
  3. Whenever this layer is launched, a GetPOIs request is sent to your web service.
  4. Based on the parameters specified in the GetPOIs request, the web service needs to provide a valid JSON response according to the Developer API , such as POIs information.
  5. The Layar server validates the response and passes the JSON response to the Layar client.
  6. The JSON response (such as spots information) is interpreted and shown in the Layar client on the phone.

How to write a layer web service ?

A layer can be written in various programming languages, as long as the response is in JSON format.