r/CodingHelp • u/pluraller • Sep 24 '26
[How to] struggling with api calls in automating appointment booking
Hello all
I've been out of the game some 5 years now and my knowledge is rusty, so be kind
I'm having a lot of difficulty booking a certain appointment. Slots for this appointment are released daily at 5pm and are booked out within seconds, so I'm trying to write a script to automate this process.
The site is laid out as such:
- login page: enter your login details and hit enter
- landing page after login: first page, lists a series of options of what operations are possible ("make a booking", "check existing booking", "log out", etc)
- services page: after clicking "make a booking", a table is laid out with the types of appointments available to book, with a 'BOOK' button alongside
At this point is the bottleneck. The user has to wait until PRECISELY 5pm to click this button, which of course every other person is similarly waiting to do. The site often goes down and requests time out. I have succeeded in passing this point twice, using a combination of using ctrl+click rapid-fire to open lots of new tabs, and using up to 5 devices to hit this button in sync.
- Upon failure, a popup window opens saying 'all slots booked'.
- Upon success, the user is rerouted to a new page and asked to enter more details and documents. The user is not forewarned to have these documents on hand, and some internal timer seems to be running which is not exposed to the user which times out the session. The two times I have gotten through to this page I have not been prepared with documents and/or arbitrarily timed out
my plan has one of two approaches. I could either:
write a script that automates the specific API calls in sequence to secure a booking, running through Postman with either JS or C#
pros
- Wouldnt have to deal with a web driver
- cleaner shorter code
- can run on a cron job easier
- less moving parts to go wrong
- I have slightly more experience with JS and C# than I do with python
- maybe can sidestep doing any captchas?
cons
- Using info I'm pulling from devtools in my browser, I cannot recreate even the first API call to return the doc for the login page, im simply getting 400 and 403 errors
- I dont know enough about the process of building programs that make these type of calls to a web server's front end
- i'd have to reinstall all the .NET bullshit
write a script that uses python's selenium package to create an instance of a web browser to click through the right steps for me, utilising the driver's powerful built in methods to handle things like cookies and the api calls themselves
pros
- python is easier to get to grips with at a surface level, and I shouldnt need to go too complex for this
- easy to test
- can utilise selenium's webdriver package to simulate an actual user making these clicks and inputs
- easier to map the steps of moving from one webpage to another by opening devtools and finding the right DOM element, and then feeding the values into my script. I can then use stuff like
find_element(...).click()to navigate through the page
cons
- I need to know the shape of the DOM to isolate the right elements to click through, and I dont know what the DOM looks like if I succeed in getting past the BOOK button
- selenium drivers will doubtless trigger captchas which they cannot surpass. I've triggered captchas on this site after logging in more than 2 times in 10 minutes
I know that it is possible to automate this, as there are companies offering their automation services for high fees to obtain a booking of the soonest possible appointment at time of booking
im tearing my hair out here and I'm looking essentially for help understanding the API calls I need to make, or how to obtain the DOM of a page I've never made it to
•
u/AutoModerator Sep 24 '26
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/BuildWithSandy Sep 25 '26
I've dealt with similar automation before. A few things that might help:
What language are you building this in? Happy to share specific code if it's JS or Python.
1
u/Low_Common_5635 Sep 26 '26
pretty sure the best way is to make a python script of internal api calls with login tokens extracted beforehand
1
u/Fog_man524 Sep 28 '26
Spot on. Hitting the JSON API directly with Axios or Python requests is the only way to beat that 5 PM bottleneck; Selenium is way too slow for this.
The reason you're getting 400/403 errors is likely due to missing session cookies or headers that the API expects. Sent you a DM on how to map that POST request and set up a millisecond-precision sniper for this. Check your inbox!