Hooks
Update an existing hook
Update an existing hook with the Java SDK.
PUT
/hooks/{hook_id}Use blnk.hooks().update for this operation.
Call the method
String hookId = "hk_890bdbc4-467f-4670-8424-5667e41daf29";
ApiResponse<JsonNode> response = blnk.hooks().update(
hookId,
CreateHookData.create()
.name("Validate payment v2")
.url("https://api.example.com/validate-v2")
.type(HookType.PRE_TRANSACTION)
.active(true)
.timeout(45)
.retryCount(2));
| Field | Type | Description |
|---|---|---|
id | String | ID of the hook to update. |
name | String | Descriptive name for the hook. |
url | String | Endpoint URL Blnk calls when the hook runs. |
type | String | PRE_TRANSACTION or POST_TRANSACTION. |
active | boolean | Whether the hook is enabled. |
timeout | Number | Maximum time in seconds allowed for the hook to execute. |
retry_count | Number | Maximum number of retry attempts if the hook fails. |
Verify the changes
Read response.data() to confirm the updated URL, type, and active status. The hook ID stays the same.
Response
{
"id": "hk_890bdbc4-467f-4670-8424-5667e41daf29",
"name": "Pre-transaction validation",
"url": "https://api.example.com/validate",
"type": "PRE_TRANSACTION",
"active": false,
"timeout": 30,
"retry_count": 3,
"created_at": "2024-11-26T08:36:36.238244338Z",
"last_run": "0001-01-01T00:00:00Z",
"last_success": false
}
| Field | Type | Description |
|---|---|---|
id | String | Unique ID for the hook. |
created_at | String | Date and time the hook was created. |
last_run | String | Date and time the hook last executed. |
last_success | boolean | Whether the most recent execution succeeded. |