Web Services

You are here:

1. What is web service?

Web service extends Geohoppers so that when you enter or exit a location, you can notify a web service. The web service can be your own or someone else’s web service. All that is required is a URL (like http://example.com/service) that accepts an HTTP post and does something interesting.

2. How do I set up a web service?

To make it easy to set up a web services once and use it in all your locations, you first enter the URL in your profile under Web Services. You can then select that web service when configuring up any location and they URL will be sent a HTTP post when an enter or exit event occurs.

3. What information gets sent to the web service?

When a web service is notified, the Geohopper server sends either an HTTP POST or an HTTP GET to the specified URL, depending on how you configure the Web Connection. If you choose to use an HTTP GET, you can add any parameters you want to send as part of the url.

If you choose HTTP POST, Geohopper sends a fixed set of parameters to the web server. The data is a JSON dictionary encoded in the request body. Below example JSON object.

{“sender”:”tperfitt@twocanoes.com“,”location”:”Beacon in upstairs office”,”event”:”LocationExit”,”time”:”2013-09-11 02:03:33 +0000″}

The Content-Type of the POST request is set as “application/json.

Note that a common alternative for POST data is to set the Content-Type as”application/x-www-form-urlencoded and send the data in form parameters. This is how web forms generally work, and it is the default behavior of curl. Make sure your web service looks in the request body for the request data.

The fields in the JSON are defined as follows:

Sender: The email address of the sender.

Location: The name of the defined location that triggered the event.

Event: The type of event. Possible values are LocationEnter, LocationExit, LocationTest

Time: time the event occurred in RFC 3339 format.