API
Introduction
GeoDirectory V2 has a new API. This document gives an overview of the single on/off setting.
For detailed information, please see the API section of the docs.
The endpoint is: {yoursite.com}/wp-json/geodir/v2/
Most routes are declared there.
Read on for how to use the settings provided at:
GeoDirectory – Settings – API
Settings
General Options
- API
Select whether or not to enable the REST API. To use Geodirectory the API must be enabled.
Keys
Keys/Apps
- Add Key / Create a New API Key
For each application that communicates with the GeoDirectory site a new and unique key can be created.
Key Details
For each key that is created you can configure the following settings.
- Description
Use the description field to enter a friendly name for the key to identify it in the list of keys.
- User
Select the WordPress user to associate with the key. The user will be the owner of the key and responsible for authentication using the key.
- Permissions
Select the access type of the key: Read, Write, or Read Write.
Endpoints
To use API with GeoDirectory v2 you have to use v2 in all API routes.
For example: https://www.YOURSITE.com/wp-json/geodir/v2/
Here are some GeoDirectory API Routes:
Base route: https://www.YOURSITE.com/wp-json/geodir/v2/
Post types: https://www.YOURSITE.com/wp-json/geodir/v2/types/
CPT listings: https://www.YOURSITE.com/wp-json/geodir/v2/CPT
CPT categories: https://www.YOURSITE.com/wp-json/geodir/v2/CPT/categories
CPT tags: https://www.YOURSITE.com/wp-json/geodir/v2/CPT/tags
Taxonomies: https://www.YOURSITE.com/wp-json/geodir/v2/taxonomies
Reviews: https://www.YOURSITE.com/wp-json/geodir/v2/reviews
Fields: https://www.YOURSITE.com/wp-json/geodir/v2/fields
CPT Fields: https://www.YOURSITE.com/wp-json/geodir/v2/CPT/fields
Settings: https://www.YOURSITE.com/wp-json/geodir/v2/settings
System status: https://www.YOURSITE.com/wp-json/geodir/v2/system_status
Countries: https://www.YOURSITE.com/wp-json/geodir/v2/countries
Map Markers: https://www.YOURSITE.com/wp-json/geodir/v2/markers
Location types: https://www.YOURSITE.com/wp-json/geodir/v2/locations
Location countries: https://www.YOURSITE.com/wp-json/geodir/v2/locations/countries
Location regions: https://www.YOURSITE.com/wp-json/geodir/v2/locations/regions
Location cities: https://www.YOURSITE.com/wp-json/geodir/v2/locations/cities
Location neighbourhoods: https://www.YOURSITE.com/wp-json/geodir/v2/locations/neighbourhoods
Make sure API settings enabled at GeoDirectory > Settings > API > Enable the REST API.
FAQ – Frequently Asked Questions
How do I get the content?
WP-API
Since WP V4.5 the WP-API plugin is no longer required because WordPress has moved WP-API to core. Other plugins may require that plugin, but GDV2 does not.