How To Validate And Register A New User |
This document will show how to register a new user in the ParaPlan Passenger Portal.
Tip |
---|
The ParaPlan Passenger Portal is the only 3rd party application that is granted access to this section of the API. |
Submit user information. Get back list of UserCandidate. Each item has a tempToken.
Use tempToken to get information to validate user.
Create a new User in the system.
Send a GET request to: ClientIDForRegistration(String, String, String, String)
1 var findRiderUrl = $"https://aws.engraph.com/ParaPlanREST/UserService/Register?FirstName=Nick&LastName=Hexum&IdentifingInformation=3114&Device=p3"; 2 using (WebClient client = new WebClient()) 3 { 4 string s = client.DownloadString(findRiderUrl); 5 var candidate = JsonConvert.DeserializeObject<List<UserCandidate>>(s); 6<codeEntityReference>P:ParaPlanREST.Models.UserCandidate.tempToken</codeEntityReference> 7 }
It will return a list of UserCandidate that contains information about the potential candidates found and a tempToken for future requests.
places is a list of frequently used places in ParaPlan for that agency. The list is randomized and reduced to 10 total places. If there are less then 10 frequent places, then the list is augmented with national chains.
[ { "agencyName": "CATCH", "agencyPhone": "", "clientID": "737", "firstName": "jevon", "identifyingInformation": "1029", "lastName": "corpening", "places": [ "CVS", "Dr. Smith", "VA Hospital", "Walmart", "Children's Mercy", "Walgreens", "Subway", "McDonalds" ], "restURL": "https://aws.engraph.com/REST/CATCH/", "tempToken": "d3d35ca7-f5a5-4e93-bc4b-edde2ccd45a2" } ]
Important |
---|
Each is only allowed to make calls on that specific restURL. This call could potentially return more than one result in the future and each validation call would need to be made with the proper token. |
Send a GET request to: TripsInWrapper(String, String, String, String, String, String)
1var getTripsUrl = $"restURL/TripService/TripsInWrapper?Token=tempToken&Device=p3&Date=2018-05-02&Client=311&DateDelta=-10"; 2using (WebClient client = new WebClient()) 3{ 4 string s = client.DownloadString(getTripsUrl); 5 var trips = JsonConvert.DeserializeObject<ListResponse<Stop>>(s); 6 7}
It will return a ListResponseT of Stop
{ "errorMessage": "", "success": true, "tokenExists": true, "tokenIsValid": true, "list": [ { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "additionalRiders": "No extra riders", "arrived": false, "cancelled": false, "clientFirstName": "Jevon", "clientId": 737, "clientLastName": "Corpening", "clientPhone": "215-528-4960", "comments": "", "copay": "$0.00 ($17.00 Billed)", "copayDue": 0, "copayPaid": 0, "copayPaymentType": null, "driverFirstName": "Andrea", "driverId": 56, "driverLastName": "Mason", "executed": false, "extraRiders": 0, "fleetManagerId": 11210, "location": { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "address1": "1400 REED ST", "address2": "", "city": "PHILADELPHIA", "lat": 39.932874, "lng": -75.1689063, "name": "Carlisle Reed Recovery", "phone": "", "state": "PA", "zip": "19146" }, "needsWheelChairBus": false, "noShow": false, "odometer": 0, "otherRiders": 0, "routeName": "500", "signatureUrl": "", "stopType": "PU", "timeActual": "/Date(1526511600000+0100)/", "timeAppointment": "/Date(1526563800000+0100)/", "timeArrived": "/Date(-62135596800000+0000)/", "timeScheduled": "/Date(1526563800000+0100)/", "tripDate": "/Date(1525215600000+0100)/", "tripId": 205583, "tripProgramName": " Carlisle- Reed Recovery", "wheelchairInfo": "" }, { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "additionalRiders": "No extra riders", "arrived": false, "cancelled": false, "clientFirstName": "Jevon", "clientId": 737, "clientLastName": "Corpening", "clientPhone": "215-528-4960", "comments": "", "copay": "$0.00 ($17.00 Billed)", "copayDue": 0, "copayPaid": 0, "copayPaymentType": null, "driverFirstName": "Andrea", "driverId": 56, "driverLastName": "Mason", "executed": false, "extraRiders": 0, "fleetManagerId": 11210, "location": { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "address1": "5032 WALNUT ST", "address2": "", "city": "PHILADELPHIA", "lat": 39.9563636779785, "lng": -75.2227249145508, "name": "Home", "phone": "215-528-5297", "state": "PA", "zip": "19139" }, "needsWheelChairBus": false, "noShow": false, "odometer": 0, "otherRiders": 0, "routeName": "500", "signatureUrl": "", "stopType": "DO", "timeActual": "/Date(1526511600000+0100)/", "timeAppointment": "/Date(1526563800000+0100)/", "timeArrived": "/Date(-62135596800000+0000)/", "timeScheduled": "/Date(1526564580000+0100)/", "tripDate": "/Date(1525215600000+0100)/", "tripId": 205583, "tripProgramName": " Carlisle- Reed Recovery", "wheelchairInfo": "" }, { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "additionalRiders": "No extra riders", "arrived": false, "cancelled": false, "clientFirstName": "Jevon", "clientId": 737, "clientLastName": "Corpening", "clientPhone": "215-528-4960", "comments": "", "copay": "$0.00 ($17.00 Billed)", "copayDue": 0, "copayPaid": 0, "copayPaymentType": null, "driverFirstName": "Andrea", "driverId": 56, "driverLastName": "Mason", "executed": false, "extraRiders": 0, "fleetManagerId": 11210, "location": { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "address1": "5032 WALNUT ST", "address2": "", "city": "PHILADELPHIA", "lat": 39.9563636779785, "lng": -75.2227249145508, "name": "Home", "phone": "215-528-5297", "state": "PA", "zip": "19139" }, "needsWheelChairBus": false, "noShow": false, "odometer": 0, "otherRiders": 0, "routeName": "500", "signatureUrl": "", "stopType": "PU", "timeActual": "/Date(1526511600000+0100)/", "timeAppointment": "/Date(1526542200000+0100)/", "timeArrived": "/Date(-62135596800000+0000)/", "timeScheduled": "/Date(1526541120000+0100)/", "tripDate": "/Date(1525215600000+0100)/", "tripId": 205582, "tripProgramName": " Carlisle- Reed Recovery", "wheelchairInfo": "" }, { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "additionalRiders": "No extra riders", "arrived": false, "cancelled": false, "clientFirstName": "Jevon", "clientId": 737, "clientLastName": "Corpening", "clientPhone": "215-528-4960", "comments": "", "copay": "$0.00 ($17.00 Billed)", "copayDue": 0, "copayPaid": 0, "copayPaymentType": null, "driverFirstName": "Andrea", "driverId": 56, "driverLastName": "Mason", "executed": false, "extraRiders": 0, "fleetManagerId": 11210, "location": { "errorMessage": "", "success": false, "tokenExists": true, "tokenIsValid": true, "address1": "1400 REED ST", "address2": "", "city": "PHILADELPHIA", "lat": 39.932874, "lng": -75.1689063, "name": "Carlisle Reed Recovery", "phone": "", "state": "PA", "zip": "19146" }, "needsWheelChairBus": false, "noShow": false, "odometer": 0, "otherRiders": 0, "routeName": "500", "signatureUrl": "", "stopType": "DO", "timeActual": "/Date(1526511600000+0100)/", "timeAppointment": "/Date(1526542200000+0100)/", "timeArrived": "/Date(-62135596800000+0000)/", "timeScheduled": "/Date(1526541900000+0100)/", "tripDate": "/Date(1525215600000+0100)/", "tripId": 205582, "tripProgramName": " Carlisle- Reed Recovery", "wheelchairInfo": "" } ] }
Send a POST to: CompleteRegistration(VerifiedUser, String, String, String, String)
Important |
---|
Make sure the correct restURL is being used. Use the restURL from the UserCandidate. |
1var postUrl = $"restURL/UserService/CompleteRegistration?Device=p3&Version=0.1&DeviceToken=none&UTCOffSet-4"; 2 3var http = (HttpWebRequest)WebRequest.Create(new Uri(postUrl)); 4http.Accept = "application/json"; 5http.ContentType = "application/json"; 6http.Method = "POST"; 7 8string parsedContent = @"{ 9 "tempToken" : "<token from previous call>", 10 "clientID" : "737", 11 "email" : "jevon@engraph.com", 12 "password" : "p@ssword", 13 "agencyName" : "CATCH", 14 "restURL" : "https://aws.engraph.com/REST/CATCH/" 15 }"; 16ASCIIEncoding encoding = new ASCIIEncoding(); 17Byte[] bytes = encoding.GetBytes(parsedContent); 18 19Stream newStream = http.GetRequestStream(); 20newStream.Write(bytes, 0, bytes.Length); 21newStream.Close(); 22 23var response = http.GetResponse(); 24 25var stream = response.GetResponseStream(); 26var sr = new StreamReader(stream); 27var s = sr.ReadToEnd(); 28var userToken = JsonConvert.DeserializeObject<UserToken>(s);
It will save the Rider as a user in the ParaPlan database and will login the user and return a UserToken.
You will NOT need to make a second call to Login(String, String, String, String, String, String)
{ "errorMessage": "", "success": true, "tokenExists": true, "tokenIsValid": true, "AssignedRoute": null, "AssignedTimes": null, "AssignedTripCount": null, "AssignedVehicle": null, "CanCallClients": false, "CanCancel": false, "CanScheduleTrips": false, "CanViewVehicles": false, "ClientCanRequestTrips": true, "ClientID": 737, "CollectGPS": false, "DatabaseID": 0, "DefaultPaymentType": null, "DeviceToken": null, "Key": "80f4281c-e7c7-4ec4-8b52-3b29ff5696ec", "LocalDriverID": 0, "Name": "Jevon Corpening", "PPPAccess": 1, "ProviderCanRequestTrips": false, "ProviderCanViewClientDetails": false, "ProviderPrograms": "", "ProviderProgramsList": null, "RESTUrl": "https://aws.engraph.com/REST/CATCH/", "UserId": 128, "UserType": 2 }