Viewings Endpoints
List Viewings
File: api/viewings.php
Method: GET
Auth: Required JWT (Authorization header)
| Param | Type | Description |
|---|---|---|
search | query string | Search text for house title |
status | query string | Filter by status (ALL, PENDING, ACCEPTED, CANCELLED) |
Returns viewing requests grouped by time category:
cancelled- Cancelled viewingsnone- No time setthisWeek- Within next 7 daysthisMonth- This month but beyond 7 dayspast- Past viewingsother- Future viewings beyond this month
If the user is in an accepted housemate group, returns viewings for all group members.
Each viewing includes: house title, address, images, agent_id, viewing reward redemption status, rating, and (US) crm_name.
Request Viewing
File: api/requestViewing.php
Method: POST
Auth: Required JWT (POST body)
| Param | Type | Description |
|---|---|---|
jwt | string | User JWT |
houseId | string | House ID |
message | string | Enquiry message |
houseAddress | string | House address (for emails) |
city | string | City name |
slot | array | Optional viewing slot ({id, date, start_time}) |
request_type | string | ENQUIRY (default) or INFORMATION |
timezone | string | User timezone |
isEntrataHouse | string | "true" for Entrata-managed properties |
entrataSlotDate | string | Entrata tour date |
entrataSlotTime | string | Entrata tour time |
Flow:
- Validates user exists and has role=3 (student)
- If slot provided, status is
ACCEPTED; otherwisePENDING - US Entrata houses: Sends lead to Entrata via their API before creating local record
- Creates
viewing_requestsrecord - Increments house enquiry count
- Schedules push notifications (initial, pre-viewing, post-viewing)
- Updates HubSpot with rental action data
- Sends email to agent(s):
- UK: Email to specific agent
- US: Email to all agents in the same company
- Sends SMS to agent if they opted in via
landlord_preferences - Creates portal notification for the agent
- Awards viewing reward code if eligible
Response: 200 with { "message": "Request sent successfully.", "viewing_id": 123 }
Cancel Viewing
File: api/cancelViewing.php
Method: POST
Auth: Required JWT
Cancels a viewing request.
Change Viewing Status
File: api/changeViewingStatus.php
Method: POST
Auth: Required JWT
Updates the status of a viewing request.
Rate Viewing
File: api/rateViewing.php
Method: POST
Auth: Required JWT
Submits a post-viewing rating.
Update Viewing Message
File: api/updateViewingMessage.php
Method: POST
Auth: Required JWT
Updates the message on a viewing request.
Update Viewing Notification Indicator
File: api/updateViewingNotificationIndicator.php
Method: POST
Auth: Required JWT
Marks viewing notification indicators as read.
Available Time Slots
File: api/availableTimeSlots.php
Method: POST
Returns available viewing time slots for a property.
Booked Slots
File: api/booked_slots.php
Method: POST
Returns already-booked viewing slots.
Booking Slots
File: api/booking_slots.php
Method: POST
Returns booking slot availability.
Get Entrata Tour Times
File: api/getEntrataTourTimes.php
Method: POST
Fetches available tour times from Entrata (US only).
Website Enquiries
Files: api/websiteEnquiries/acceptViewingTime.php, api/websiteEnquiries/declineViewingTime.php
Handles website-originated viewing time acceptance and decline (used by agents via email links).
Check Existing Website Enquiry
File: api/checkExistingWebsiteEnquiry.php
Method: POST
Checks if a website enquiry already exists.
Viewing Reward Flow
Multiple utility files support the viewing reward system:
utils/remainingViewingRewardCode.php- Checks available reward codes for a cityutils/viewingRewardTokenDisplayed.php- Tracks if reward banner was shown- Rewards are assigned from a pool per city (
viewing_request_rewardstable)