Skip to main content
LinkedIn
Copied!

Table of Contents

Understanding the Preferred Geofences services

Version:

Only available versions of this content are shown in the dropdown

The Preferred Geofences set of services can be used to determine the most relevant set of Geofences for a particular location. For example, when a customer launches the app on their device, the app can invoke the service to determine the list of nearby Geofences to monitor. The app can then provide this list to the device’s OS to monitor, thereby avoiding having to continually poll whether the current location has tripped a Geofence.

The following two variants of the service exist:

  • HandleMktPreferredFences HTTP Service

    http://<host>:<port>/prweb/PRHTTPService/PegaMKTGeolocation/Services/HandleMktPreferredFences?Key=Closest&BaseLatitude=<DeviceLatitude>&BaseLongitude=<DeviceLongitude>&ClosestCount=<NumberOfGeofences>

  • HandleMktPreferredFences REST Service

    http://<host>:<port>/prweb/PRRestService/PegaMKTGeolocation/Services/HandleMktPreferredFences/Closest?BaseLatitude=<DeviceLatitude>&BaseLongitude=<DeviceLongitude>&ClosestCount=<NumberOfGeofences>

Both variants expect the following inputs:

  • BaseLatitude – Latitude of the device
  • BaseLongitude – Longitude of the device
  • ClosestCount – Number of closest Geofences to return for the specified location. If this value is not provided, the system returns up to ten Geofences.

The content type for the response differs between the variants:

Service Type Response Content Type
HTTP text/plain (content is still JSON)
REST application/json

A sample (formatted) response is shown below:

{   GeolocationArray : [{     "GeofenceName" : "PegaBedford",     "RadiusNormalized" : "1000",     "Latitude" : "42.928",     "Longitude" : "-71.464"   }, {     "GeofenceName" : "ManchesterBRAirport",     "RadiusNormalized" : "3218.688",     "Latitude" : "42.928",     "Longitude" : "-71.438"   }] }

In error scenarios, such as when the location coordinates are not provided, an error response is returned.

{   ErrorsList : [{     "pyMessage" : "Error: One or more input parameters are invalid."   }] }

The system provides out-of-the-box support for closest Geofence lookup (“Key” request parameter is set to “Closest” in the example URLs above). Custom implementations may extend this functionality to provide support for other lookup modes.

Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us