Skip to Content
API v1EndpointsViewings Endpoints

Viewings Endpoints

List Viewings

File: api/viewings.php Method: GET Auth: Required JWT (Authorization header)

ParamTypeDescription
searchquery stringSearch text for house title
statusquery stringFilter by status (ALL, PENDING, ACCEPTED, CANCELLED)

Returns viewing requests grouped by time category:

  • cancelled - Cancelled viewings
  • none - No time set
  • thisWeek - Within next 7 days
  • thisMonth - This month but beyond 7 days
  • past - Past viewings
  • other - 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)

ParamTypeDescription
jwtstringUser JWT
houseIdstringHouse ID
messagestringEnquiry message
houseAddressstringHouse address (for emails)
citystringCity name
slotarrayOptional viewing slot ({id, date, start_time})
request_typestringENQUIRY (default) or INFORMATION
timezonestringUser timezone
isEntrataHousestring"true" for Entrata-managed properties
entrataSlotDatestringEntrata tour date
entrataSlotTimestringEntrata tour time

Flow:

  1. Validates user exists and has role=3 (student)
  2. If slot provided, status is ACCEPTED; otherwise PENDING
  3. US Entrata houses: Sends lead to Entrata via their API before creating local record
  4. Creates viewing_requests record
  5. Increments house enquiry count
  6. Schedules push notifications (initial, pre-viewing, post-viewing)
  7. Updates HubSpot with rental action data
  8. Sends email to agent(s):
    • UK: Email to specific agent
    • US: Email to all agents in the same company
  9. Sends SMS to agent if they opted in via landlord_preferences
  10. Creates portal notification for the agent
  11. 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 city
  • utils/viewingRewardTokenDisplayed.php - Tracks if reward banner was shown
  • Rewards are assigned from a pool per city (viewing_request_rewards table)
Last updated on