Fetch and Web API

The Weavy backend exposes a Web API to work with data. To help you access these api endpoints, the drop-in UI provides a weavy.fetch() function which seamlessly authenticates the api calls as the currently signed-in user and avoids you going through the trouble of setting up authentication on your own.

Using weavy.fetch()

You may use the built-in fetch() function for calling the Web API endpoints on the server. You can send data along with the request or retrieve data from the server. The fetch method integrates your existing token authentication into your ajax calls. You may also provide any additional settings for the request and the function returns a promise.

The fetch API is used iternally and you may override or extend any settings by providing custom fetch() init settings.

weavy.fetch(url, [data], [method], [settings])

Only the url is required, the other parameters are optional. The function returns a promise with the result data.

The server always returns data with UTC timezone, so you may have to convert any dates and times into your preferred timezone.

Parameter Type Description
url string URL to the JSON endpoint. May be relative to the connected server.
[data] object Data to send. May be an object that will be encoded or a string with pre encoded data.
[method] string HTTP Request Method. Defaults to GET.
[settings] object Settings to extend or override fetch() init settings.
weavy.fetch("/api/some_endpoint", {
  name: "My Thing"
}).then(function (result) {
  console.log("API Endpoint", result);
async function getMyData() {
  var myData = await weavy.fetch("/api/some_endpoint", {
    name: "My Thing"

  console.log("API Endpoint", myData.someProperty)

  return myData;
Weavy Docs