This manual is being depreciated. Much of the information here is out of date.

The new Jomres Documentation, updated in 2022, can be found at Jomres.net/documentation.

Using Postman to access the API

This article is old, you should use this new article in the Technical Blog. It shows you how to install endpoint plugins and uses the most up-to-date UI from Postman

You can use POSTMAN to talk to the Jomres API.

Postman is an excellent tool that allows you to send API queries to your Jomres installation. If you'd like to test functionality that already exists, or if you've added new functionality, then this is a great way to test the code without having to build an entire app. Once you've confirmed it's working, then you'll be ready to build your application later on.

postman

 

We'll start with  a simple example, getting a user's favourites.

GET

Here you can see the basic panel in Postman. The method to get the user's favourites is /favourites/ ( trailing slash is important ), so to call Jomres from my localhost, and get the favourites for the user who created this API key set, you would set the method to GET, and the url to http://localhost/quickstart/jomres/api/favourites/

postman 1 favourites

Before we can the favourites, we first need to get an access token, so if you need to click on the Authorization tab, and choose OAuth2 from the dropdown.

 

postman 2 oauth2

 

Click "Get New Access Token", you'll see a popup like this. Give the token a name, set the url ( trailing slash! ) and enter the Client ID and Client Secret you created earlier. Next set the Grant Type to "Client Credentials". Finally, click "Request Token".

 

postman 3 new access token

 

Now you'll see that the token has been pulled from the server and is available in the Authorization tab. I'll click "Localhost" and the token's details will appear to the right.

 

postman 4 got token

These are the token's details, complete with the scope that it supports. in "Add token to" change the dropdown to "Header" and then click "Use Token".

postman 5 use token

Ok, we're ready to get the user's favourites. Click "Send".

 

postman 6 get favourites

 

In the panel down below, you'll see the response, which is exactly as we expected.

 

postman 7 result

 

 

POST

Ok, that was a good first step. Let's now go ahead and test posting data to our server. We'll change the method to POST, so to send a new favourite property uid we'll first change the method to POST, and then add the id of the property we want to the end of the url, like this :

 

postman 10 POST favourites camping

 

Again, you will need a token, so if you haven't already done that, get and use your token.

postman 11 POST favourites oauth2

Ok, here are some of my favourites already. The "Some Camping Area" property is the property with id 7.

 

postman 12 POST favourites camping before

So now, when I click Send, this is the response I'll see in Postman.

postman 13 POST favourites response

 

And when I reload the page, here you can see that "Some Camping Area" has been added to my favourites.

 

postman 14 POST favourites camping after