Geofencing web API

From Maria GDK Wiki
Jump to navigation Jump to search

This page explains the use of the geofencing web API. Use Fiddler to test http POST/DELETE.

Notifications

Retrieve geofencing notifications newer than provided generation. Uses HTTP GET. http://localhost:9006/geofencingwebservice/json/notifications?generation=-1

Parameter Type Description
generation int, required Latest known generation of the caller. All notifications with generation higher than this number will be returned. Pass -1 to return all notifications

Returns NotificationQueryResult. Note that the result contains the current notification generation of the service. By passing this number as generation input paramter on subsequent calls, only new notifications will be returned.

Rules

Retrieve active geofencing rules. Uses HTTP GET. http://localhost:9006/geofencingwebservice/json/rules Returns array of GeoFenceRuleDef.

Setrule

Set single geofencing rule. Uses HTTP POST. http://localhost:9006/geofencingwebservice/json/setrule. Request body contains json/xml representation of single rule definition. Sample request body:

{
  "GeoFenceConditionXml":
  "<fieldcondition op=\"Eq\" field=\"Name\" value=\"Ytre Oslofjord\"\/>",
  "Id":"568c528a-459c-4c6f-87af-6be33486dcad",
  "Interactions":3,
  "NotificationTemplate":
  {
    "Description":null,
    "GeoShapeFields":["Name"],
    "Heading":"[time] [track.name] [interaction][ shape.Name]",
    "NotificationLevel":1,
    "PredefinedValues":[{"Key":"region","Value":"local"}],
    "TrackFields":["name","ais.DESTINATION","type","identity"]},
    "TrackConditionXml":null
  }
}

Note that "Interactions" is a bitwise combination of numerical values from here. Returns guid of rule on success.

Deleterule

Delete single geofencing rule. Uses HTTP DELETE. http://localhost:9006/geofencingwebservice/json/deleterule/4bb9385f-e2b3-457b-aef1-5b77950ff9d6. Returns true on successful delete.