Skip to content

Requests Data

Introduction

The Data Store provides access to the data of all the Requests that have been defined in the app, including the current status, their response payload, and more.

When a request is executed, Wized will automatically populate the request's data in the Data Store:

Accessing a request's data

Each request's data can be accessed via the r keyword in the Function Editor, using the request's name as the property accessor:

js
r.request_name.data;

Request data

The following fields are available for each request:

FieldDescription
r.request_name.dataThe response payload of the request. This is the data that was returned by the server. If the request has not been executed yet, this field will be null.
r.request_name.hasRequestedA boolean indicating whether the request has been executed or not.
r.request_name.isRequestingA boolean indicating whether the request is currently being executed or not.
r.request_name.statusThe HTTP status code of the response. If the request has not been executed yet, this field will be null.
r.request_name.statusTextThe status message corresponding to the HTTP status code of the response. If the request has not been executed yet, this field will be null.
r.request_name.okA boolean indicating whether the request was successful or not. This is equivalent to r.request_name.status >= 200 && r.request_name.status < 300. If the request has not been executed yet, this field will be null.

Updating a request's data

Although it is possible to update a request's data using custom JavaScript by mutating the r.request_name object, it is not recommended to do so as it may lead to unexpected behavior.

Instead, you should rely on Wized's built-in request execution mechanism. Whenever a request is executed via an Action, Wized will automatically update the request's data in the Data Store.