State Reset Options API
The following document outlines the details of the State Reset Options API.
API Description
Objective
The State Reset Options API retrieves a list of modules from which a transaction can be reset. This functionality enables platform applications to provide users with the ability to reset a transaction to a specific point in their workflow journey.
| Input | Output |
|---|---|
| Authentication headers and transaction details | A list of available modules where the transaction can be reset to, including module names and identifiers |
API URL
https://ind-state.idv.hyperverge.co/v2/state-reset/options
API Endpoint
state-reset/options
Overview
The State Reset Options API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should send all data in JSON format through a POST request.
Authentication
You need a unique pair of application ID ( appId ) and application key (appKey) from HyperVerge to verify your identity for accessing the State Reset Options API.
API Request Details
Method - POST
Headers
| Parameter | Mandatory or Optional | Description | Valid Values |
|---|---|---|---|
| appid | Mandatory | The application ID shared by HyperVerge | Not Applicable - this is a unique value |
| appkey | Mandatory | The application key shared by HyperVerge | Not Applicable - this is a unique value |
| transactionid | Mandatory | The unique transaction ID for the user journey | Not Applicable - this is a unique value |
| workflowid | Mandatory | The unique workflow identifier | Not Applicable - this is a unique value |
| authorization | Optional | Bearer token for authentication (required if appKey not provided) | Bearer token |
Request
The following code snippet demonstrates a standard curl request for the State Reset Options API:
curl --location --request POST 'https://ind-state.idv.hyperverge.co/v2/state-reset/options' \
--header 'appid: <Enter_the_HyperVerge_appId>' \
--header 'appkey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionid: <Enter_the_transaction_ID>' \
--header 'workflowid: <Enter_the_workflow_ID>' \
--header 'authorization: Bearer <Enter_your_auth_token>'
Success Response
The following code snippet demonstrates a success response from the State Reset Options API:
{
"statusCode": 200,
"status": "success",
"result": {
"resetOptions": [
{
"moduleName": "<Module_Name>",
"moduleId": "<Module_ID>"
},
{
"moduleName": "<Module_Name>",
"moduleId": "<Module_ID>"
}
]
}
}
Success Response Details
The following table outlines the details of the success response from the State Reset Options API:
| Parameter | Type | Description |
|---|---|---|
| statusCode | number | The HTTP status code of the response |
| status | string | The status of the request |
| result.resetOptions | array | The list of modules where the transaction can be reset to |
| result.resetOptions[].moduleName | string | The display name of the module |
| result.resetOptions[].moduleId | string | The unique identifier of the module |
Error Responses
The following are some error responses from the State Reset Options API:
- CPR Not Enabled
- Dashboard State Reset Not Enabled
- Empty Execution Order
- End State Not Reached
{
"statusCode": 400,
"status": "failure",
"errorCode": "cpr_not_enabled"
}
{
"statusCode": 400,
"status": "failure",
"errorCode": "dashboard_state_reset_not_enabled"
}
{
"statusCode": 400,
"status": "failure",
"errorCode": "empty_execution_order"
}
{
"statusCode": 400,
"status": "failure",
"errorCode": "end_state_not_reached"
}
- Unauthorized Access
- Workflow Not Found
- State Not Found
- Internal Server Error
{
"statusCode": 401,
"status": "failure",
"error": "Invalid or missing authentication",
"errorCode": "unauthorized_access"
}
{
"statusCode": 404,
"status": "failure",
"errorCode": "workflow_not_found"
}
{
"statusCode": 404,
"status": "failure",
"errorCode": "state_not_found"
}
{
"statusCode": 500,
"status": "failure",
"error": "<Error_Message>",
"errorCode": "internal_server_error"
}
Error Response Details
A failure or error response from the module contains a failure status, with a relevant status code and error message.
The following table lists all error responses:
| Status Code | Error Code | Error Description |
|---|---|---|
| 400 | cpr_not_enabled | The Cross Platform Resume (CPR) functionality is not enabled for this workflow |
| 400 | dashboard_state_reset_not_enabled | The dashboard state reset functionality is not enabled for this workflow |
| 400 | empty_execution_order | The request contains no modules that have been executed in this transaction |
| 400 | end_state_not_reached | The transaction has not reached an end state |
| 401 | unauthorized_access | The request contains invalid or missing authentication credentials |
| 404 | state_not_found | The transaction state was not found or has expired |
| 404 | workflow_not_found | The specified workflow was not found in the system |
| 500 | internal_server_error | Please contact HyperVerge for investigation |