Last active
February 17, 2023 09:18
-
-
Save BlakeStevenson/b9d1950d028f312f582d66a5becdaee3 to your computer and use it in GitHub Desktop.
Create a Texas DPS appointment at the closest office & soonest time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 protected]", | |
"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); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hey im new at this how do i executed?