Authentication Endpoints: - /api/preview/app/authentication/login (POST) - Description: - Login endpoint - Parameters: - username (string|required) - password (string|required) - preview_token (string|semi-required) - Token used for mapping a user to a token to use for sending push notifications. Not required, strictly speaking, but pass it. - Success Response: - Json object of: - jwt - json web token used for authenticating on all routes - user_role - admin/salesAgent/salesManager. admins and sales managers see sales manager dashboard - android_scanning_key - Android license scanner scanning key - android_parsing_key - Android license scanner parsing key - ios_scanning_key - IOS license scanning key - ios_parsing_key - IOS license parsing key - Error Responses: - 'Invalid Login' (403) - Self explanitory - /api/preview/app/authentication/scanning-keys (GET) - Description: - Gets the android/ios scanning/parsing keys for idscan.net - Success Response: - android_scanning_key - Android license scanner scanning key - android_parsing_key - Android license scanner parsing key - ios_scanning_key - IOS license scanning key - ios_parsing_key - IOS license parsing key - /api/preview/app/authentication/preview-token (POST) - Description: - Passes a push notification token to the back-end - Parameters: - preview_token - Success Response: - OK Dashboard Endpoint: - /api/preview/app/dashboard (GET) - Description: - Gets the # of notifications for the dashboard. Videos, test drives, and unread text messages - Success Response: - object with - videos - unread_messages - test_drives - pending_scans Customer Endpoints: - /api/preview/app/customer/search (GET) - Description: - Returns an array of customers that have a name/email/phone that matches the search query passed - Parameters: - search (string | required) - Success Response: - Array of customer objects - id, name, email, phone, phone_validated - /api/preview/app/customer/{customer_id}/get (GET) - Description: - Gets customer data and lead requests tied to them - Success Response: - object with: - customer - Contains customer data - lead_request - Contains an array of lead requests for the customer - /api/preview/app/customer/new (POST) - Description: - Adds a customer (maybe). If the customer already exists, it will return the customer object - Parameters: - name (string|required) - phone (string|required) - email (string|optional) - ignore_carrier (boolean|optional [default false]) - Determines if the user is ignoring the fact that we can't verify a mobile number. False means it WILL validate phone # - Success Response: - Customer object - Error Responses: - 'This phone number is not recognized as a mobile number' - If ignore_carrier is false, this can happen if twilio doesn't think this is a mobile number - /api/preview/app/customer/{customerId}/loans - Description: - Gets the latest dl scan data for the passed customer - Success Response: - An array of the results of the dl scan - /api/preview/app/customer/{customer_id}/edit - Description: - Edits a customer - Parameters: - phone (string|optional) - name (string|optional) - email (string|optional) - ignore_carrier (boolean|optional) - boolean passed (default false) to skip the carrier check - Success Response: - Returns the customer as a json object - Error Response: - This phone number is not recognized as a mobile number - /api/preview/app/customer/{customer_id}/delete (POST) (Don't use, not sure what would happen) - Description: - Deletes a customer SMS Endpoints: - /api/preview/app/sales-sms/send (POST) - Description: - Sends a text message from the logged in user - Parameters: - phone (string|required) - message (string|required) - Success Response: - 'Message Sent' - Error Responses: - 'Invalid User' - This means the back-end couldn't validate the logged in user type for some reason. Shouldn't happen. - /api/preview/app/sales-sms/threads (GET) - Description: - Gets an array of threads (ie: conversations) with customers - Parameters: - sales_agent_id (integer|optional) - Irrelavant if you ARE a sales agent since it automatically grabs just theirs. Only need for managers/admins trying to view threads for a specific sales agent - Success Response: - Array of thread objects - last_message - The most recent text that was sent/recieved - date - user_id - user_type - admin/salesAgent/salesManager - customer_id - customer_name - customer_phone - /api/preview/app/sales-sms/thread (GET) - Description: - Gets a specific thread (ie: conversation) with a single customer - Parameters - phone (string|optional) - customer_id (int|optional) - Success Response: - Array of message objects - id - The message id - customer_id - customer_name - customer_phone - message - incoming - user_id - user_type - admin/salesAgent/salesManager - is_read - Error Response: - 'Unable to retrieve the thread. No customer found.' - This means that the customer_id passed was invalid and couldn't find the customer OR the phone number passed doesn't have a customer. - /api/preview/app/sales-sms/read (POST) - Description: - Marks messages as read by customer id - Parameters: - customer_id (int|required) - Success Response: 'Complete' - Error Response: - 'Customer not found' - the id passed for the customer wasn't associated to any customer My Review Endpoints - /api/preview/app/my-review/send-review-link (POST) - Description: - An endpoint to send a link for a customer to review the dealer - Parameters: - phone (string|required) - Success Message: - 'Message Sent!' Car Inventory Endpoints - /api/preview/app/car-inventory/list (GET) - Description: - Gets the inventory of the dealership based on the type (if any) passed - Parameters: - type (string|optional [default=all] - new - used - all - Success Response - Array of car objects - id - stock_number - has_inspection_video - Only true if pushed to app AND there wasn't one taken already - has_walkaround_video - Only true if pushed to app AND there wasn't one taken already - year - make - model - miles - vin - new - /api/preview/app/car-inventory/upload (POST) - Description: - Uploads a new car or used car, inspection or walk-around video - Parameters: - car_id (int|required) - The id of the car from /api/preview/app/car-inventory/list - upload_type (string|required) - inspection - walkaround - file (file?|required) - The video being uploaded - Success Response: - 'Video Uploaded' Lead Request Endpoints - /api/preview/app/lead-request/list (GET) - Description: - Gets lead requests which are actions that need to be completed by the logged in user. There are many types so this generally won't be used without the "type" parameter but it is technically optional. - Parameters: - type (string|optional) - video (for the videos/leads tab) - testDrive (for the test drive icon) - finance - carAppraisal - sub_type (string|optional) - previewScan (for scans - status (string|optional) - completed - pending - all (default) - start_date (date|optional) - end_date (date|optional) - search (string|optional) - Searches: customer name/phone, agent first/last/phone, request type/subtype/stock number - Success Response: - Array of lead requests - Error Response: - 'If searching by date range, please include both a `start_date` and `end_date`' - 'Invalid start or end date passed' - Happens if the back-end was unable to parse the date format passed - 'End date is before start date' - /api/preview/app/lead-request/{leadRequestId}/test-drive/update (POST) - Description: - This updates test drive lead requests to either show/now show and marks it as completed. - Parameters: - {leadRequestId} (int|required) - Passed in the endpoint - type (string|required) - show (to mark the test drive as a the customer showed up & completed) - noShow (to mark the test drive as the customer didn't show up & completed) - Success Response: - 'Test Drive Request Completed' - Error Response: - 'Lead Request Not Found' - Happens when the leadRequestId isn't found in the system - 'Lead Request is not a Test Drive' - Happens when the leadRequestId isn't a test drive lead request - /api/preview/app/lead-request/{leadRequestId}/video/upload (POST) - Description: - Uploads a video based for the lead request id passed, tries to compress it, then sends a link to the customer on the lead with a link to the video. - Parameters: - {leadRequestId} (int|required) - Passed in the endpoint - file (file|required) - Success Response: - 'Lead Request Video Uploaded' - Error Response: - 'Lead Request is not a video' - 'This lead request has already been completed' - 'Could Not Find Video Directory' - Server-side error. Shouldn't happen but might happen if there was an issue with the initial server config. - 'Video Upload Error: ' - After the : it should have an explanation of what the issue was. - /api/preview/app/lead-request/video/new (POST) - Description: - Creates a new 'custom' lead request for the agent to upload any type of video they want - Parameters: - customer_id (required|int) - stock_number (optional|string) - Success Response: - An object of the new lead request generated. - Error Response: - 'Customer Not Found' - /api/preview/app/lead-request/{id} (GET) - Description: - Gets the data for one specific lead request - Success Response: - A lead request object - /api/preview/app/lead-request/{id}/delete (POST) - Description: - "Deletes" a lead request. Stays in the db but sets it's 'deleted' flag to true - Success Response: - Lead Request Deleted' Sales Lead Endpoints - /api/preview/app/sales-lead/{sales_lead_id} (GET) - Description: - Gets data for the passed sales lead - Success Response: - An array of the sales lead object - /api/preview/app/sales-lead/unassigned (GET) - Description: - Gets all leads that haven't been assigned to a sales agent yet - Success Response: - An array of sales lead objects - /api/preview/app/sales-lead/{id}/assign-sales-agent (POST) - Description: - Assigns a sales agent to the sales lead - Parameters: - sales_agent_id (required|int) - Success Response: - 'Complete' Scanner Endpoints - /api/preview/app/scanner/scan (POST) - Description: - Sends the scanned license and pictures to add a customer/lead/request - Parameters: - data (string|required) - Pass this parameter with anything in it to simulate a successful response. Do not pass this to simulate a failure on the scan. - phone (string|optional) - Pass if filled out or gathered from /customer/search endpoint after the original scan - front (file|optional) - Picture of the front of the license - back (file|optional) - Picture of the back of the license - Success Response: - 'Scan Successful' - Error Response: - 'Invalid JSON Data' - Happens if the 'data' variable is not valid json - 'Could not find front/back directory' - 500 error if something went wrong in server config - /api/preview/app/scanner/list (GET) - Description: - Gets a list of scans - Parameters: - start_date (string) - end_date (string) - status (string) (default all) - new - viewed - complete - rejected - all - Success Response: - An array of scan object - Error Response: - If searching by date range, please include both a `start_date` and `end_date` - Invalid start or end date passed - End date is before start date - /api/preview/app/scanner/run-pre-screen (POST) - Description: - Runs the pre-screen credit pull through transunion to get credit history/score - Parameters: - credit_pull_id - first_name (string) - middle_name (string|optional) - last_name (string) - phone (string|optional) - dob (string) (date of birth) - address1 (string) - address2 (string|optional) - city (string) - state (string) - zip (string) - Success Response: - The preview object (ie scores/loans/etc). Note: It may be different from the credit_pull_id that was passed because if there was already a completed scan, we want to enter a brand new one to track the results of every attempted pull - Error Response: - 'Invalid Date Passed' - You'll get this error if the DOB format wasn't able to be parsed by php - 'License array is missing a required attribute' - Happens if there was some missing information from the parameters that wasn't caught - 'Failed to connect to processing server. Please try again later.' - Might happen if the transunion server goes down and can't process the pull - 'Connection Timed out. Please try again later.' - Similar to the last one but the server is technically up but unable to provide a response - /api/preview/app/scanner/get/{credit_pull_id} (GET) - Description: - Endpoint for getting the pre check item's data. Will mark the pre check item as viewed if it's status is currently new - Success Response: - A pre check object with credit score/loans/customer/etc. - /api/preview/app/scanner/{credit_pull_id}/reject (POST) - Description: - Endpoint to reject the scan (idk either) - Success Response: - Scan marked as rejected Sales Agent Endpoints - /api/preview/app/sales-agent/list (GET) - Description: - Gets a list of active sales agents - Success Response - An array of sales agent objects - /api/preview/app/sales-agent/{id} (GET) - Description: - Gets a specific sales agent - Success Response: - Object of the sales agent - /api/preview/app/sales-agent/{id}/edit (POST) - Description: - Updates a sales agent - Parameters: - first_name (string|required) - last_name (string|required) - email (string|required) - phone (string|required) - password (string|optional) - If not passed, it won't be updated. Make note of this in the front-end - Success Response: - 'Sales Agent Updated' - Error Response: - 'Missing Required Parameter' - 'Sales Agent Not Found' - /api/preview/app/sales-agent/new (POST) - Description: - Updates a sales agent - Parameters: - first_name (string|required) - last_name (string|required) - email (string|required) - phone (string|required) - password (string|required) - Success Response: - 'Sales Agent Added' - Error Response: - 'Missing Required Parameter' - 'Sales Agent Already Exists' - If email is already assinged to an agent - /api/preview/app/sales-agent/{id}/delete (POST) - Description: - Deletes (deactivates) a sales agent - Success Response: - 'Sales Agent Deleted' - Error Response: - 'Sales Agent Not Found' Reporting Endpoints - /api/preview/app/sales-agent-ranking (GET) - Description: - Gets the various critical metrics ranked by agent - Parameters: - category (string|required) - scans - # of lead requests w/ type 'finance' - videos_sent - # of lead requests w/ type 'vide' - leads - # of leads - test_drives - # of lead requests completed w/ type 'testDrive' - messages_inbound - # of incoming sales sms text messages - reviews_sent - # of pre check client interactions with type 'review_customer_sent' - all - Gets all of the above - start_date (string|required) - end_date (string|required) - sales_agent_id (int|optional) - Success Response: - An array of objects with the agent and the metric being captured - Error Response: - 'Invalid Start or End Date Passed' - Gets returned if the string start/end date passed wasn't able to be parsed - 'Invalid Category Sent' - Must be a valid category from above - /api/preview/app/reporting/usage/cumulative (GET) - Description: - Gets an agent usage summary of the totals for the date range passed with optional sales agent qualifier - Parameters: - start_date (string|required) - format needs to be mm/dd/yyyy - end_date (string|required) - format needs to be mm/dd/yyyy - sales_agent_id (int|optional) - Success Response: - A json object of the results - Error Response: - 'Invalid Date Format Passed' - Either the start or end date isn't the mm/dd/yyyy format - 'No Sales Agent Found' - If sales_agent_id IS passed, it will error out if the system couldn't find the agent - /api/preview/app/reporting/credit/cumulative (GET) - Description: - Gets a credit summary summary of the totals for the date range passed with optional sales agent qualifier - Parameters: - start_date (string|required) - format needs to be mm/dd/yyyy - end_date (string|required) - format needs to be mm/dd/yyyy - sales_agent_id (int|optional) - Error Response: - 'Invalid Date Format Passed' - Either the start or end date isn't the mm/dd/yyyy format - 'No Sales Agent Found' - If sales_agent_id IS passed, it will error out if the system couldn't find the agent Sales Manager Endpoints - /api/preview/app/sales-manager/list (GET) - Description: - Gets a list of active sales managers - Success Response - An array of sales manager objects - /api/preview/app/sales-manager/{id} (GET) - Description: - Gets a specific sales manager - Success Response: - Object of the sales manager - /api/preview/app/sales-manager/{id}/edit (POST) - Description: - Updates a sales manager - Parameters: - first_name (string|required) - last_name (string|required) - email (string) - /api/preview/app/sales-manager/{id}/delete (POST) - Description: - Deletes (deactivates) a sales manager - Success Response: - 'Sales Manager Deleted' - Error Response: - 'Sales Manager Not Found' Setting Endpoints: - /api/preview/app/settings/get (GET) - Description: - Key/value pair of settings - Success Response: - 'preview_video_text' with the value to pre-populate the input if there is one - /api/preview/app/settings/edit (POST) - Description: - Updates the settings round in the /settings endpoint - Parameters: - preview_video_text - the text. Will error if > 109 characters - Success Response: - Successfully updated settings - Error Response: - Invalid Parameter Value - > 109 characters for preview_video_text