The first step in connecting to your API is to visit the Setup page, which can be found by clicking on the WPGetAPI menu in the sidebar of your WordPress admin. Once you click that, you will see the Setup page below.
On this page we add the basic details of the API we will be using. We need to fill in all 3 fields to get started and once they are filled in and we hit save, a new tab and menu item will be created for your API. The new tab is where you will then add the endpoint details.
API Name field
The first field is where you add the name of your API and this can be any name you choose. This name will be used in the new tab and new menu item that is created after saving this page.
Let’s say you were using the Autotrader API to pull in vehicle data for cars that you are selling. It wouldn’t make much sense to name this API as ‘Spaghetti Monster’. Naming it ‘Autotrader’ is probably the best bet here.
Once we save our settings here on the Setup page, you will see a new tab added to the top of the page which is labelled as whatever you used for the API Name.
Unique ID field
The Unique ID field is used to identify your API when using the shortcode or the template tag. If you are using multiple different API’s, then you must ensure this is unique.
Using the Autotrader API again as an example, it would make sense to set the Unique ID as autotrader. Or you could do Autotrader, or auto_trader or something along those lines
Below we see how this Unique ID is used within the shortcode and template tag. It is used to identify the API.
Base URL field
The Base URL field is used to add the API’s base URL which you will be able to find within your API’s documentation.
We use the base URL in this step and then in the next step when adding the endpoints, you can add the individual endpoints which are then appended to this base URL to create the full URL that will be called.