API Action: send a browser request
Send an explicit browser request with query parameters, headers and a chosen request body.
Send an explicit browser request with query parameters, headers and a chosen request body.
Before you begin
Section titled “Before you begin”- An App Connect page and an endpoint whose request fields and JSON response shape you know. Use a development endpoint for write examples.
Choose the browser or server boundary
Section titled “Choose the browser or server boundary”API Action runs in the user’s browser. Use it for browser-accessible APIs with a known JSON response. Put private service credentials and trusted authorization logic in a server API Connector action. For a form with named controls or files, API Form is usually the clearer starting point.
Configure the request
Section titled “Configure the request”Name the component apiSave and enable No Auto Load for a request that changes data. Trigger Load from a deliberate button event.
| Control or value | Meaning and use |
|---|---|
| ID / Url | ID is the page binding name. Url is the endpoint, or bind Dynamic Url for an intentional runtime destination. |
| Method | GET, POST, PUT, PATCH or DELETE. GET sends query parameters and no body. Use the verb required by the endpoint. |
| Data Type | Controls the outgoing body, not the accepted response format. JSON serializes Input Data. Auto POST creates FormData, appending array fields with []; Auto for other non-GET methods stringifies the supplied value rather than producing JSON. |
| Text Data | Text stringifies the supplied data. The installed runtime sets Content-Type to application/text; override through API Headers if the endpoint requires text/plain or another media type. |
| No Auto Load | Prevents initial and reactive URL/parameter loads. Set it explicitly for mutations; repeated automatic loads could repeat a write. |
| Credentials | Enables withCredentials subject to browser/server cross-origin rules. It does not authenticate the request by itself. |
| Define API Schema | Declares fields for editor pickers. It does not create the endpoint or enforce its response schema. |
| Input Data / Query Parameters / API Headers | Body, URL query and header name/value pairs are separate inputs. Use Input Data for JSON body fields; keep private secrets out of all browser fields. |
Example: save a non-sensitive preference
Section titled “Example: save a non-sensitive preference”On a development endpoint that accepts PATCH /api/preferences, choose PATCH and JSON. Bind Input Data compact to a boolean true, enable No Auto Load and trigger apiSave → Load from a button. The request body should be {“compact”:true}. If the endpoint returns {“saved”:true}, read apiSave.data.saved on Success. Confirm the server response before showing Saved; a completed request alone does not prove a write.
Understand reloads and retained data
Section titled “Understand reloads and retained data”The installed fetch runtime reloads on URL or parameter changes only when No Auto Load is off; changing Input Data or headers alone does not send a request. Load accepts query parameters and a Reload flag. It aborts a previous HTTP request and preserves previous response data until a new success replaces it. Timeout, when set as a runtime attribute, is in seconds. A Text outgoing body still requires a JSON success response.
Distinguish completion from success
Section titled “Distinguish completion from success”Use Success for work that depends on a successful JSON response. Done also runs after errors and aborts, so it is suitable for cleanup rather than a saved-successfully message.
| Control or value | Meaning and use |
|---|---|
| Start / state.executing | A request starts; disable repeated submission or show a loading indicator while executing is true. |
| Success / data | The HTTP path accepts status below 400 only when the response parses as JSON. Empty 204 responses and HTML login pages produce a JSON error. |
| Invalid / Unauthorized / Forbidden / Rate Limit | HTTP 400 / 401 / 403 / 429 have distinct event branches. Handle the applicable branch; these do not also trigger the generic Error event. |
| Error / lastError | Other HTTP failures, transport failures, timeouts or invalid successful JSON. Inspect status, message and response; do not expose private server details in a public error label. |
| Abort / Done | Abort ends the browser request. It does not undo work already accepted by the server. Done means the attempt ended. |
| Upload / Download | Progress events expose loaded, total and lengthComputable. Progress objects provide position, total and percent. Upload at 100% means bytes were sent; server processing can still fail. |
Continue with the matching workflow
Section titled “Continue with the matching workflow”Use the related guide to build and check the surrounding page workflow.
Check your result
Section titled “Check your result”You can configure the request, bind its real output and distinguish a successful result from loading, validation and error states.