apply_leave
Preview and submit hostel leave requests on VTOP with a two-step confirm flow, validating dates, times, place, reason, and rules before filing.
Instructions
Apply for hostel leave on VTOP. THIS WRITES TO VTOP and creates a real request for your proctor, so it is deliberately two-step. Call 1 (preview): pass the details with confirm OMITTED or false. Nothing is sent. You get back the normalised values, every rule that fired, any classes the leave would make you miss, and a previewToken. Call 2 (submit): repeat the SAME details plus confirm=true and the previewToken. The token is server-signed, single-use and expires after 10 minutes, so if anything changed since the preview the submission is refused and you must preview again. Always show the user the preview and get their agreement before calling with confirm=true. Never invent a previewToken or set confirm=true on a first call. Rules enforced before submitting: OG1 (Day Outing) must return by 18:00 inclusive; dates must be ISO YYYY-MM-DD and not in the past; to-date cannot precede from-date; visiting place is required and capped at 150 characters; reason is required. Times are normalised, so '6:00 PM' becomes '18:00'. Requires login.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | Reason for the leave. Keep it specific. | |
| toTime | Yes | Return time, same format as fromTime. For OG1 (Day Outing) it must be 18:00 or earlier - 18:00 itself is allowed, 18:01 is refused. | |
| confirm | No | Leave this unset/false for the first call: nothing is submitted, and you get back a preview plus a previewToken. Re-call with confirm=true and the SAME fields and token to actually submit. Never set confirm=true on the first call. | |
| fromTime | Yes | Departure time. 24-hour HH:MM is safest, but '6:00 PM', '1800' and '8.30' are all normalised automatically. | |
| leaveCode | Yes | Leave type CODE, not the label. SO=Special Outing, WP=With Parent Leave, EP=Official Leaves, SV=Summer Vacation, WV=Winter Vacation, HT1=Home Town, LG1=Local Guardian, EY1=Emergency Leave, OG1=Day Outing. Use get_leave_types if unsure. | |
| leaveToDate | Yes | Return date as ISO YYYY-MM-DD. | |
| previewToken | No | The token returned by the preview call. Required with confirm=true. It is checked against these exact field values, so editing any field after previewing invalidates it — re-run the preview. | |
| leaveFromDate | Yes | Departure date as ISO YYYY-MM-DD. Must not be in the past. | |
| visitingPlace | Yes | Where you are going. Max 150 characters. |