If you're like me, you hate busy gyms. I was very happy to learn that I can view my gym's capacity at any time with The Gym Group:
But there's a catch! It can only be viewed using their app.
This annoying decision is made even more annoying after you discover that in order to get the number, the app is just making a simple web request. You really have to wonder why I need to provide location data (a necessary app permission), and have Google Play Services enabled, just to see the response of a web request.
Let's get it without the app. The process is 2 steps:
- Logging in and obtaining:
- a cookie
- your ID
- your gym's ID
- Sending a web request to
/gym-busyness
I'll be using hurl to send requests, but you can use any tool that can send web requests and read responses.
Start by making a POST request to /login
with your username and password. The Content-Type
is x-www-form-urlencoded
(a simple web form). Here is it in hurl:
POST https://thegymgroup.netpulse.com/np/exerciser/login
[FormParams]
password: ********
guestUuid:
username: ****@******.net
and then run:
npx hurl login.hurl --very-verbose
From the output, find and copy:
- your cookie - set by the
set-cookie
response header uuid
homeClubUuid
Now all we need to do is make a GET request to /gym-busyness
. Here it is in hurl with placeholders for the values above:
GET https://thegymgroup.netpulse.com/np/thegymgroup/v1.0/exerciser/{put uuid here}/gym-busyness?gymLocationId={put homeClubUuid here}
Accept: application/json
Accept-Encoding: gzip
Connection: Keep-Alive
Cookie: {put set-cookie here}
Host: thegymgroup.netpulse.com
User-Agent: okhttp/4.10.0
X-NP-API-Version: 1.5
X-NP-APP-Version: 6.1
X-NP-User-Agent: clientType=MOBILE_DEVICE; devicePlatform=ANDROID; deviceUid=; applicationName=The Gym Group; applicationVersion=6.1; applicationVersionCode=60
That's it! No app required. Here's an example of the result:
{
"gymLocationId": "",
"gymLocationName": "London Wandsworth",
"currentCapacity": 20,
"currentPercentage": 12,
"historical": [
{
"hour": "12AM",
"percentage": 4
},
{
"hour": "2AM",
"percentage": 2
},
{
"hour": "4AM",
"percentage": 6
},
{
"hour": "6AM",
"percentage": 21
},
{
"hour": "8AM",
"percentage": 29
},
{
"hour": "10AM",
"percentage": 34
},
{
"hour": "12PM",
"percentage": 32
},
{
"hour": "2PM",
"percentage": 36
},
{
"hour": "4PM",
"percentage": 40
},
{
"hour": "6PM",
"percentage": 33
},
{
"hour": "8PM",
"percentage": 5
},
{
"hour": "10PM",
"percentage": 0
}
],
"status": "open"
}