Skip to content

Instantly share code, notes, and snippets.

@BlakeStevenson
Last active February 17, 2023 09:18
Show Gist options
  • Save BlakeStevenson/b9d1950d028f312f582d66a5becdaee3 to your computer and use it in GitHub Desktop.
Save BlakeStevenson/b9d1950d028f312f582d66a5becdaee3 to your computer and use it in GitHub Desktop.
Create a Texas DPS appointment at the closest office & soonest time.
const axios = require('axios');
async function getLocations() {
const locationsData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocation", {
"TypeId": 71,
"ZipCode": "75028",
"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);
})();
@spartan-g
Copy link

hey im new at this how do i executed?

@spartan-g
Copy link

i guees u dont want to answer :c

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