Skip to content

Instantly share code, notes, and snippets.

@BlakeStevenson
Last active May 2, 2024 21:47
Show Gist options
  • Save BlakeStevenson/e0323256e4395752b6fea814d5e5ebcc to your computer and use it in GitHub Desktop.
Save BlakeStevenson/e0323256e4395752b6fea814d5e5ebcc to your computer and use it in GitHub Desktop.
Create an appointment at the Texas DPS at the closest location, soonest time, programatically.
const axios = require('axios');
async function getLocations() {
const locationsData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocation", {
"TypeId": 71,
"ZipCode": "10001",
"CityName": "",
"PreferredDay": 0
});
return locationsData.data;
}
async function getTimes(lid) {
const timeData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocationDates", {
LocationId: lid,
TypeId: 71,
SameDay: false,
StartDate: null,
PreferredDay: 0
});
return timeData.data;
}
async function createAppointment(time, site, respId) {
const appointmentData = await axios.post("https://publicapi.txdpsscheduler.com/api/NewBooking", {
"CardNumber": "",
"FirstName": "Blake",
"LastName": "Stevenson",
"DateOfBirth": "mm/dd/yyyy",
"Last4Ssn": "ssn4",
"Email": "email@example.com",
"CellPhone": "(123) 456-7890",
"HomePhone": "",
"ServiceTypeId": 71,
"BookingDateTime": time, //2020-10-16T08:00:00
"BookingDuration": 45,
"SpanishLanguage": "N",
"SiteId": site,
"SendSms": false,
"AdaRequired": false,
"ResponseId": respId
});
return appointmentData.data;
}
async function getResponseId() {
const respIdData = await axios.post("https://publicapi.txdpsscheduler.com/api/Eligibility", {
"FirstName": "Blake",
"LastName": "Stevenson",
"DateOfBirth": "mm/dd/yyyy",
"LastFourDigitsSsn": "ssn4",
"CardNumber": ""
});
return respIdData.data[0].ResponseId;
}
(async () => {
// get response id
const responseId = await getResponseId();
console.log(responseId);
// get locations
const locations = await getLocations();
console.log(locations[0]);
// get times
const times = await getTimes(locations[0].Id);
console.log(times.LocationAvailabilityDates[0]);
// create appointment
const appointment = await createAppointment(times.LocationAvailabilityDates[0].AvailableTimeSlots[0].StartDateTime, locations[0].Id, responseId);
console.log(appointment);
this.appointment = appointment;
})();
@markdjones82
Copy link

How did you find out about the api? I don't see any info on it when googling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment