CM Map Locations (CMML) - External API - Adding Locations Based on Current Location (REST API)


Adding Locations From External Services (REST API)

Back to User Guide

Example Uses

You can build an app with these buttons: "Create Location" and "Track Location".

  1. Generate Location - When accessed, creates a location entry in the plugin. Read more below
  2. Track Location - When accessed, starts tracking the user location in real time (Read the separate guide)

What is This Feature

It's possible to track the user location and send that information to the plugin.


How To Add Location Entry Based on GPS Location

Using the feature is simple:

  1. Adjust the settings (read more below)
  2. Create or generate a key
  3. Customize the URL, including the key
  4. Add the URL to your app

Generate Location URL - How to Use

The URL you will add in your is structured like this:

http://your-site.com/wp-json/cmloc/v1/add_location?description=yourdescription&name=your location name&LocCAT=category&LocLAT=50.401699&LocLONG=30.252512&key=abc123 

The underlined green elements above can be customized. 

  • description
  • name
  • LocCAT
  • LocLONG
  • images (encode the images URL with base64. Example online tool)
  • loc-address
  • loc-postal-code
  • loc-phone-number
  • loc-email
  • loc-website
  • loc-email
  • loc-url
  • key - has to match the key set in the plugin's settings:

Example with all attributes

https://example.org/wp-json/cmloc/v1/add_location?description= Nice view&name= Mount Everest&LocCAT= Mountain&LocLAT= 50.401699&LocLONG= 30.252512&images= R0cHM6Ly93d3cuY21pbmRzLmNvbS93cC1jb250ZW50L3RoZW1lcy9EaXZpL2hvbWVw
YWdlNC9pbWFnZXMvQi93b3JkcHJlc3Mtc3EucG5n|aHR0cHM6Ly93d3cuY21pbmRzLmNvbS93cC1j
b250ZW50L3RoZW1lcy9EaXZpL2hvbWVwYWdlNC9pbWFnZXMvQi93b3JkcHJlc3Mtc3EucG5n
&loc-address= 5th Street 29A&loc-postal-code= 012345&loc-phone-number= 11222333&loc-email= admin@route.com&loc-website= example.com/&key= 6240e806-3001-4164-81

Plugin Settings

Navigate to the Admin Dashboard  CM Maps Route Manager  Settings. Click on the Setup tab.

All settings are located under the Location REST API section.

  • Enable REST API - Enable this feature
  • API key for adding location via REST API - Create your own key or click the button to generate a random one. This field is obligatory. 
  • Enter the IP from which you can connect - Leaving it empty allows connections from any IP - this might not be secure!
    To add multiple IPs, separate them with commas. For example: 1.1.1.1, 1.1.1.2, 1.1.1.3 etc.
  • Create category if it doesn't exist - Enabled to let the plugin create the category if it doesn't exist
  • Don't add locations with the same name - Enable to prevent the plugin from creating locations with repeated names

More information about the CM Map Routes Manager WordPress Plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us