ZAZA.rocks SDK
The ZAZA SDK allows you to programmatically interact with ZAZA.rocks. You can create bags, manage files and alter structured data, just like you can from the UI.
Browser
The latest ZAZA SDK is hosted at: https://zaza.rocks/sdk/v1/zaza-sdk/zaza.js
When creating a website-in-a-bag you can easily import the SDK using the following script tag:
<script src="/sdk/v1/zaza-sdk/zaza.js" charset="utf-8"></script>
Once the SDK is included, it becomes available as a global Zaza
object.
For example, creating a bag and uploading a file becomes as easy as:
const view = await Zaza.createBag()
console.log(`Created bag https://zaza.rocks/${view.qid}`)
const demoFile = new File("Hello world!", "hello.txt");
view.upload(demoFile)
NPM
You can also install the library using NPM:
npm i @esoptra/zaza-sdk
This allows you to import each object separately:
import { View } from '@esoptra/zaza-sdk'
const v = new View('<viewId>')
Alternatively, you can emulate the browser API by importing the entire package:
import * as Zaza from '@esoptra/zaza-sdk'
const v = new Zaza.View('<viewId>')
Examples
Please refer to the esoptra/zaza-examples repository for examples of both the ZAZA and ZAZA Bridge SDKs.
Documentation
The ZAZA.rocks documentation is available at https://help.zaza.rocks.