/

CM Map Locations (CMML) - How To - Add Locations From External Services (REST API)


Adding Locations From External Services (REST API)

Back to User Guide

What is This Feature

It's possible to add locations to your website from external services.

Example

You can build an app with the button "Create Location". When clicked, it generates a location based on the user's GPS information.

This feature was introduced in version 2.4.0. 


How To Use This Feature

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

Customizing URL

The URL you will add 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= HR0cHM6Ly93d3cuY21pbmRzLmNvbS93cC1jb250ZW50L3RoZW1lcy9EaXZpL2hvbWVw
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