New API: General Info

We are excited to announce the addition of the General Info API. Using the General Info API, you can retrieve the information about your site from the General Info section of your site’s Dashboard.

For example, you can use the General Info API to create a custom footer that shows your business address, phone number, and schedule.

How does it work?

  • Import the Wix Site Backend API.

  • Call the General Info API functions to retrieve the info you want.

Example

/****************
 * Backend Code *
 ****************/
  
import wixSite from 'wix-site-backend';

export function getAddress() {
  return wixSite.generalInfo.getAddress();
}

export function getPhone() {   
  return wixSite.generalInfo.getPhone(); 
}

/*****************
 * Frontend Code *
 *****************/
import {getAddress, getPhone} from 'backend/generalInfo';

// ...

getAddress()
  .then( (address) => {
    $w("#street").text = address.street;
    $w("#city").text = address.city; 
    $w("#state").text = address.state;
  } );

getPhone()   
  .then( (phone) => {     
    $w("#phone").text = wixSite.generalInfo.getPhone();
  } ); 

Learn more
To learn more, see generalInfo in the API reference.

6 Likes

Nice!!!