Beagle v1.5 is no longer actively maintained. The documented version you are viewing may contain deprecated functionality. For up-to-date documentation, see the latest version .
SendRequest
is used to make HTTP requests.
The Send Request structure is:
Attribute | Type | Required | Definition |
---|---|---|---|
url | String or Binding | ✓ | Server URL. |
method | RequestActionMethod or Binding | ✓ | HTTP method. |
headers | Map <String, String> or Binding | Header items for the request. | |
data | Any | Content that will be deliver with the request. | |
onSuccess | List<Action> | Success action. | |
onError | List<Action> | Error action. | |
onFinish | List<Action> | Finish action. |
See below an example of a button that send a POST
request with data user:
Button(
text = "Send a request",
styleId = "DesignSystem.MyNativeButtonStyle",
onPress = listOf(
SendRequest(
url = https://myUrl.com/endpoint",
method = RequestActionMethod.POST,
data = User(
name = "John",
email = "jonh@email.com",
password = "password",
confirmPassword = "password"
),
headers = mapOf(
"Content-Type" to "application/json"
),
onSuccess = listOf(
Alert(
title = "SUCCESS",
message = "Success"
)
),
onError = listOf(
Alert(
title = "ERROR",
message = "Error"
)
),
onFinish = listOf(
Alert(
title = "FINISH",
message = "Finish"
)
)
)
)
)
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.