This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a location.
function getLocation(_id: string): Promise<Location>;
ID of the location to retrieve.
import { locations } from "wix-business-tools.v2";
import { elevate } from "wix-auth";
/* Sample _id value: '0a965e36-4071-4df0-905b-75458817430a' */
export async function myGetLocationFunction(_id) {
try {
const elevatedGetLocation = elevate(locations.getLocation);
const myLocation = await elevatedGetLocation(_id);
console.log("Here are the details of the location:", myLocation);
return myLocation;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_id": "0a965e36-4071-4df0-905b-75458817430a",
* "address": {
* "streetAddress": {
* "apt": "",
* "name": "Calle Miguel Hidalgo",
* "number": "15"
* },
* "city": "La Reforma",
* "postalCode": "22000"
* },
* "archived": false,
* "default": false,
* "description": "Our brand new, budget store in the heart of Mexico City!",
* "email": "store@example.com",
* "phone": "+52 55 1234 5678",
* "name": "Mexico Store",
* "revision": "2",
* "status": "ACTIVE",
* "timeZone": "America/Mexico_City"
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.