uo-wix-data
v3.1.6
Published
Unofficial Wix Data API. Uses HTTP requests to connect.
Downloads
7
Readme
About
This is an unofficial NPM Package which includes some functions from the Wix Data API by Wix. The purpose of this package is to use Wix Data (database collections) in a different environment (site or Node.js app). It uses HTTP requests to connect to Wix.
Installation
npm install uo-wix-data --save
Check documentaiton for more steps.
Documentation
On your wix site create a backend file called http-functions.js
and inside it put the code that is in uowd-http.js.
Getting started
1. Create a Wix site (blank template) and enable Developer mode.
2. On your wix site create a backend file called http-functions.js
(if not created already) and inside it put the code from uowd-http.js.
3. In const wdToken = "foobar";
replace foobar
with your secret token.
4. On your Node.JS file import uo-wix-data with const wixData = require("uo-wix-data")
and set up wixData.setup("username", "my-site", "token")
replacing username
with your wix username, my-site
with your site name and token
with your secret token.
Functions
setup(username, siteName, token)
- Sets everything up and returns the WixData object.enableDevMode(void)
- Sends requests to published site.disableDevMode(void)
- Sends requests to saved site.
WixData object
get
query
eq
,ne
,gt
,ge
,lt
,lt
,le
,between
,contains
,starsWith
,endsWith
,hasAll
,hasSome
,isEmpty
,isNotEmpty
,ascending
,descending
,limit
,include
,find
,count
get
query
insert
bulkInsert
insertReference
isReferenced
queryReferenced
update
bulkUpdate
save
remove
bulkRemove
removeReference
replaceReferences
Example:
const wixData = require("uo-wix-data")
.setup("username", "my-site", "foobar");
// Example
wixData.query("Users").eq("name", "John").find().then((result) => {
console.log(result.items[0]);
});
Version 3.0.0
- Changed setup function to return WixData object
- Added new functions:
insertReference
isReferenced
queryReferenced
save
removeReference
replaceReferences
Version 2.0.0
- Added new functions:
- bulkInsert
- bulkUpdate
- bulkRemove
- query.include
- query.count
- enableDevMode
- disableDevMode
- Changed some error messages:
type_invalid
toinvalid_type
token_invalid
toinvalid_token
query_type_invalid
toinvalid_query_type
query_failed
tofind_failed