Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Call Xano from workflows ​

The API Request action calls one of your Xano endpoints from a workflow. Use it whenever a table isn't enough: to create, update, or delete records, to run your own logic in Xano, or to sign a user in.

It works in Interface workflows (it runs in the browser) and in backend workflows such as API Endpoints (it runs on your WeWeb server).

Add the action ​

  1. In a workflow, click + Add action.
  2. Select Xano → API Request.
  3. Select the API Group, then the Endpoint. Each endpoint shows its method and path, for example POST /job.
  4. Fill in the inputs WeWeb shows for that endpoint:
    • URL Params: The parts of the path in curly braces, such as {job_id}.
    • Query Parameters: The inputs of a GET endpoint.
    • Body: The inputs of a POST, PUT, PATCH, or DELETE endpoint.
  5. (Optional) Open Advanced to add Custom Headers, or to turn on Stream Response.

Bind each input to the data you want to send, for example the value of a form input.

In a backend workflow, select the Xano connection in the action. Without it, the action fails with Xano connection is required.

EDIT ENDPOINTS REPLACE THE WHOLE RECORD

Xano's default edit endpoints replace the record with what you send. If you only send the field you changed, the other fields can go back to their default value. Send every field of the record when you update it.

Use the response ​

The action returns more than the data of your endpoint:

json
{
  "body": { "id": 12, "title": "Product designer" },
  "status": 200,
  "headers": { "content-type": "application/json; charset=utf-8" }
}

What your endpoint returned is in body. In the next actions, bind to the body of the action's result, for example body.id, not to the result itself.

Send the signed-in user ​

When Xano is your Authentication System and a user is signed in, WeWeb adds their session to the request. You don't need to add an Authorization header:

  • In Interface workflows, the session is always sent. A header you add yourself would be replaced by it.
  • In backend workflows, the session of the user who called the API Endpoint is sent.

The session only goes to the Xano connection used for sign in. If your project has a second Xano connection, its requests don't carry the session.

Upload files ​

If your Xano endpoint expects a file (a file resource input), bind that input to a file:

  • In an Interface workflow, bind it to the value of a File upload element on your page. A single-file upload goes to a single-file input, a multiple-file upload goes to a list input.
  • In a backend workflow, add a parameter of type file to your API Endpoint, and bind the input to that parameter.

WeWeb then sends the request in the format Xano expects for files. A file URL or a storage path doesn't work: Xano needs the file itself.

Stream a response ​

Some answers take time, like the reply of an AI model. With Stream Response, your app shows the answer piece by piece while Xano produces it, instead of waiting for the end.

  1. In Xano, set up your endpoint to stream its response.
  2. In an Interface workflow, open Advanced in the API Request action and turn on Stream Response.
  3. The action becomes a loop that runs until Until Stream Ends. Add the actions that handle each piece inside it, for example a Change variable value that adds the new piece to a text variable displayed on your page.
  4. Add the actions that should run once the full answer has arrived after the loop.

Stream Response is available for GET, POST, PUT, and PATCH endpoints, in Interface workflows only. In backend workflows, the action waits for the full response.

Your Xano endpoint must stream on its own: WeWeb can't turn a normal response into a stream.

See a full streaming example →

Handle errors ​

When Xano answers with an error, the action fails and the workflow goes to its error branch. The error tells you what went wrong:

  • The HTTP status, for example 404.
  • The Xano error code, for example ERROR_CODE_NOT_FOUND or ERROR_CODE_UNAUTHORIZED.

Build your error handling on the status or the code: the error message can be empty.

See the most common errors and their fixes →

CONTINUE LEARNING

Calling Xano from workflows is also how you sign users in. Next, set Xano up as your Authentication System.

Sign users in with Xano →