Netzo Logo

Wix is a website builder.

Usage

import { wix } from 'netzo/apis/wix.ts'

const api = wix({
  accountId: Deno.env.get('WIX_ACCOUNT_ID'),
  siteId: Deno.env.get('WIX_SITE_ID'),
  apiKey: Deno.env.get('WIX_API_KEY')
})

Configuration

The wix factory function expects an object with the following, and returns an object with an API client api.

ParamTypeDefaultDescription
accountIdstringDeno.env.get('WIX_ACCOUNT_ID')the Wix account id
siteIdstringDeno.env.get('WIX_SITE_ID')the site id
apiKeystringDeno.env.get('WIX_API_KEY')the api key to use for authentication
Refer to the API documentation to get the required information.

Examples

The following examples assume you have created an api client instance.

Get site properties

Get the properties of your site.

const query: QuerySite = {}
const result = await api['site-properties'].v4.properties.get<Site>(query)
const resultData = result.properties

Find contacts

Find visitors who have shared contact information with the site.

const query: QueryContacts = {}
const result = await api.contacts.v4.contacts.get<Contacts>(query)
const resultData = result.contacts

Add contact

Add a new contact.

const data: DataAddContact = {
  info: { name: { first: 'John', last: 'Doe' } }
}
const result = await api.contacts.v4.contacts.post<Contact>(data)
const resultData = result.contact

Update contact

Update a contact by id.

const data: DataUpdateContact = {
  revision: REVISION_NUMBER,
  info: { name: { first: 'Jane', last: 'Doe' } }
}
const result = await api.contacts.v4.contacts[CONTACT_ID].patch<Contact>(data)
const resultData = result.contact

Delete contact

Delete a contact by id.

const resultData = await api.contacts.v4.contacts[CONTACT_ID].delete<{}>()

References