Bulk delete locations. The query filters are the same as for searching locations and select the candidate set; the body picks the locations within it. Provide ids, or explicitly set include to false to delete every location matching the filters (and every location outright when no filters are given); an empty body is rejected. Records whose campuses are all being deleted (a record at two of the deleted campuses included) become church-wide with target=everyone, and people who attend only at the deleted campuses stay not placed yet; while multi-org is on a record or person holding no organization of its own instead takes the organizations of the campuses it held, so it is available at every campus of those organizations and not to every organization (financial records already stay in their own). A delete never moves records to a campus they are not already at: to move them, merge each location into that campus from the Locations page instead. Records that also sit at another campus lose the deleted campuses and keep the rest; a primary campus that is deleted moves to the lowest remaining switched-on campus, else the lowest remaining location. Returns 400 with the message delete_location_merge_instead_desc when target is a campus id or people=target. Returns 400 when records, or users, roles, facility requests, campus permission overrides, form access rules, dashboard sharing rules, saved query filters, form routing rules or chat access criteria, would lose their last campus and no target is sent, or when target or people holds any other value. While multi-campus is on and multi-org is off, returns 400 with the message delete_location_limits_desc, whoever the caller is, when a role, or a user their own campus limit binds, has a campus limit only at the deleted campuses: the delete would leave them with no campus in their limit, so give each of them another campus in their limit first, or merge instead (the preview's limitsRefused, onlyHereUsers and onlyHereRoles). While multi-org is on such a limit becomes the deleted campuses' organizations instead, and a limited caller's target=everyone returns 400 (message delete_location_organization_limits_desc) only when one of them reaches past the caller: it keeps an active campus outside the caller's campuses, or keeps none and the caller does not reach it. Returns 400, naming each such location, while any of their rooms or items has a booking, an event, a check-in room or check-in history: move them to another location first. Returns a 403 HTTP response with the message campus_switch_off_limited_desc when the caller is campus- or organization-limited or holds any campus permission override, one that only adds access included, multi-campus is on and fewer than two active campuses would remain: that turns multi-campus off and lifts every campus limit, the caller's own included. Returns 404 when the selection names no location you can reach. Call /api/locations/delete/preview with the same filters and body first to see the counts. Facility requests raised for a deleted location are deleted with the answers given per booking, and form answers and app devices that name one are cleared. Users and roles whose campus limit holds only the deleted campuses keep the limit with no campus in it while multi-org is off, which narrows it; while multi-org is on they are limited to those campuses' organizations instead, and a limit that also names an organization keeps it. Campus permission overrides at the deleted campuses are removed. Form routing rules and chat access criteria that name a deleted campus lose it, and a chat access criterion left naming nothing is removed. Form access rules, dashboard sharing rules and saved query campus filters that name a deleted campus lose the deleted campuses and keep any other campus they name; a rule that named only the deleted campuses is removed and its form or shared dashboard stays limited, keeping its other rules (nothing opens to everyone); while multi-org and multi-campus are both on that rule takes those campuses' organizations instead. Service plan locations, form entries, contribution batches, background checks and donation designations that point at a deleted location are unlinked, and its rooms, items, facility resource approvers and address are removed. The whole selection is deleted in one transaction: if one location cannot be deleted, none is.
Required permission: Locations
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
200OK
401Authentication is required, or the Ocs-Api-Key header is missing or invalid.
