Instruction
To access Perfect Gym API, you need to go through these steps:
- Create developer account - an employee with specific permissions.
- Create API Client.
- Connect to Perfect Gym API using API client credentials.
In case of any doubts contact the Perfect Gym Support Team to guide you through the details!
Before you start
Make sure you have an access to a third-party software called Postman. Is a collaboration platform for API development, testing and sharing. You will need it to send request to API.
- Download the Postman program and create a free account. You will find video tutorial on how to do it.
- Log into the Postman and keep it open.
Instruction
STEP 1
Create developer's account or add permissions to existing account
If you create a new employee account for the single purpose of working with API, the employee could be a basic one (i.e. manager). Alternatively, you can also check if your current permissions allow you to work with API. If you have a third party company, that would like to connect to the PerfectGym API, we recommend you to create an employee with permissions restricted strictly to creating and utilizing API clients. This way you would not have to send the credentials via email - which is very dangerous! They would simply log into PerfectGym and create API client for themselves.
- Go to the PGM -> Clubs -> Employees -> System permissions.
- Click on the Permissions button.
- Check if the API is marked.
- Check if CreateApiClients and ApiAccess permissions are marked.
- CreateApiClients - allows you to create an API client - without this, no integration would work.
Taking back this permission makes all already created clients unusable. It's required for other permissions to even work.
- ApiAccess - if you have this permission, API clients which you create can be used to directly access API. You will find further information about this below.
If you don't know how to set these permissions, check this article.
STEP 2
How to create API Client?
1. Go to the PGM -> Settings -> API clients.
2. Click on the Create API client button.
3. In a pop-up window, set the Name (obligatory), i.e. Test Api client, and add Description (optional).
5. Click on the Create client button to confirm.
6. Now, you see two codes generated:
- Client ID - which is something similar to login when using API.
- Client Secret - this piece of information is very important, as it serves as a password. You need to copy it, because it's impossible to restore it after you close the window. However, you can always create a new client.
Do NOT close this window before copying your Client-Id and Client-Secret. You will not be able to see these values again.
Be aware that API client credentials are very sensitive pieces of information and let access a big part of the PGM system. You can make your Client ID public, but not Client Secret! Any request made with these credentials would be done on behalf of the employee that created this API Client!
Do not store Client Secret inside website scripts, or inside mobile app code! This way you'd give anyone access to precious data of your members and control over your club! Store it safely and do not share with anyone not eligible. Also: do not send it via email, it is rarely encrypted.
STEP 3
Connect to Perfect Gym API using API client credentials.
1. Go to the Postman and paste your Client-Id and Client-Secret in the Headers tab. You need to write it in the key as X-Client-id and X-Client-Secret (see screenshot below). Now, you are ready to send a request to API.
2. Click on Send to confirm.
API reference
Always up-to-date API references are available directly on your company site. Just fill address below and enjoy the unlimited power of our next-gen API.
https://your-company.perfectgym.pl/Api/Docs
For example https://presentation.perfectgym.pl/Api/Doc
Hints
How to find ClubId?
If you would like to search for your ClubId, go to Clubs -> List of clubs, then click on the three dots icon next to Club that you would like to check, and click on the Panels option. You will be redirected to the Panels page. There, pay attention to the page address bar. At the end of page address you should see this: Fid=XX, where XX is your ClubId.
Don't confuse this with the Club number which appears on the left of your club name in the List of clubs tab.