Delete locations

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

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string

Returns locations where the name contains the given search terms.

string

Returns locations where the description contains the given text.

string

Comma-delimited list of type ids. Use -1 to include locations without a type. Values come from /api/property_values/location_types/values.

boolean

Whether the location is active or not. If not provided, returns locations regardless of status.

int32

An event id, to list the locations the caller may book for that event. While multi-campus is on, a caller who administers the event (its organizer, an administrator of its group, or events write at its campuses) also gets the event's campuses and every venue (a location that is not a campus), or every location for an event with no campuses and no organization. While multi-org is on the venues are those of the event's organizations and of the organizations the caller reaches, and an event with no campuses and no organization opens a limited caller only the locations of the organizations they reach. Ignored with approvers or export, and by deletes and delete previews. An unknown event, or one the caller does not administer, is ignored.

string

Organization ids, comma-separated; honoured only while multi-org is on. Returns the locations that belong to one of them, and narrows a select-all delete and its preview the same way.

string

everyone to make records whose campuses are all being deleted church-wide (while multi-org is on, every campus of their organization). Required when the preview's targetRequired is true. A campus id returns 400 with the message delete_location_merge_instead_desc: to move the records to another campus, merge each location into it instead. Any other value returns 400, and while multi-org is on, everyone from a limited caller returns 400 with the message delete_location_organization_limits_desc when a user or role has a campus limit only at the deleted campuses and an organization that limit becomes reaches past the caller.

string

Optional. unplaced leaves people who attend only at the deleted campuses not placed yet, which the delete always does (while multi-org is on they take those campuses' organizations, unless they already name one). target returns 400 with the message delete_location_merge_instead_desc: to move people to another campus, merge each location into it instead. Any other value returns 400.

Body Params

The ids of the locations to delete

ids
array of doubles | null

The ids the operation applies to: an include list by default, or an exclude list when include is false. For deletes, required unless include is false.

ids
boolean | null

Whether ids is an include list (true, default) or an exclude list (false). Setting include to false with no ids applies the operation to every record matching the query filters.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses
200

OK

401

Authentication is required, or the Ocs-Api-Key header is missing or invalid.

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
text/plain
application/json
text/json