State Machine Service
State Machine Config

Validate a state machine configuration

1min
POST
https://{tenantSubDomain}.fxtrt.io/core/api/v1/state-machine/config/{entityCode}/validate

This API is for validating a state-machine configuration (states, sub-states and state transition rules).

Some Assumptions:

  • It is assumed that main states in config are always sequential.
  • Since it's sequential, the first main states' default substate would be the state of a new entity type instance created.
  • Also, only the last main state would have the list of terminal states defined, no other main state would have terminal states.

For each non-terminal sub-state, at least one state transition rule is expected. There are 2 types of transitions possible. Transition rule comprises of:

  • Transitions

    • Event Code code of the event
    • Reason Code reason which raised this event
    • Destination state: The state on which the instance would be transitioned to when some event is provided.
  • Transition is also possible through ttl: Time to live can be associated with a substate. If some instance of this entity type is present on such a substate, after the specific time, the state of instance would be updated to destination state.

    • Time after which the transition has to take place
    • Destination state on which the instance would be transitioned to
  • Terminal States (optional): This state list, if present, would always be present only in last main state.

  • Terminal TTL: Specifies the time to live for an instance of this entity type in the transaction database. Once this instance reaches any terminal state, the data for this instance would be deleted from the transaction database, after the specified time.

  • Callback URL (optional): The URL endpoint to call once state transition happens. The transition can be state transition due to ttl or transition due to some event.

    Also, if an instance of this entity type reaches terminal state and its being removed from transaction database, then also, this URL can be called.

    The two types of callback urls can be defined:

    • Callback URL on substate: If an instance of this entity type gets transitioned to this substate, then this URL endpoint can be called.
    • Primary Callback URL: If no other callback url is specified, then primary callback url, if specified, can be called.

Important:

  • The state machine cannot be partially updated.
  • Once the state machine is created for a particular entity type, the main states cannot be modified. Tenant can only add/update substates. Addition/updation of rest all configurations, except names of main states, is allowed.
ParameterDescriptionTypeValidation
states*List of main states with its substates and transitions.minItems: 1
ㅤ↳name*Name of the state.stringminLength: 3 maxLength: 32 pattern: Name can have alphabets and must be 3 to 16 characters long.
ㅤ↳defaultSubState*Represents default substate for this state.stringminLength: 3 maxLength: 32 pattern: Name can have alphabets and must be 3 to 16 characters long.
ㅤ↳subStates*minItems: 1
ㅤ↳name*Name of the sub-state.stringminLength: 3 maxLength: 32 pattern: Name can have alphabets and must be 3 to 16 characters long.
ㅤㅤ↳transitions*Represents an array of transition rules for this substate. Contains events and the destination state.
ㅤㅤㅤ↳eventCode*Represents code of the event for state transition.string
ㅤㅤㅤ↳reasonCode*Represents code of the reason for state transition.string
ㅤㅤㅤ↳destination*Name of the main state and its substate.minLength: 3 maxLength: 64
ㅤㅤ↳callbackRepresents callback url, which can be called to get any info about state transition of an instance or its terminal ttl expiry or to notify status of API request.stringpattern: A valid URL.
ㅤ↳terminalStatesRepresents terminal state list for this state. Only the last main state should have terminal states.minLength: 3 maxLength: 32 pattern: Name can have alphabets and must be 3 to 16 characters long.
terminalTTL*Represents time to live of an instance in a transactional database after it has reached a terminal state.stringTime string in days, hours, minutes and seconds. minLength: 2 Example- 30m, 1d 12h, 1d 12h 30m 45s etc.
callbackRepresents callback url, which can be called to get any info about state transition of an instance or its terminal ttl expiry or to notify status of API request.stringpattern: A valid URL.

*This is required.

HTTP Status Code Summary

CodeDescription
200 - OKEverything worked as expected.
| **400 - Bad Request** | The request was unacceptable, often due to missing a required parameter. |
| **401 - Unauthorized** | No valid API key provided. |
| **503 - Server Errors** | Something went wrong on our end. (These are rare.) |
Path Parameters
entityCode
*
Header Parameters
X-COREOS-REQUEST-ID
*
X-COREOS-TID
*
X-COREOS-ACCESS
*
X-COREOS-USERINFO
Body Parameters
body
*
Description
State-machine configuration for the entity type
All Of
StateMachineConfig +
states
*
terminalTTL
*
callback
Responses
200
OK
All Of
ErrorResponse +
error
*
request
*
data
400
Bad request - The server is unable to process the request due to something that is perceived to be a client error.
error
*
request
*
401
Unauthorized - The client's identity is unknown to the server. Verify that you are accessing the correct tenant and that your client ID and client secret are valid on that Tenant.
error
*
request
*
503
Server error - The server is not ready to handle the request. This could be due to maintenance downtime or system resource constraints.
error
*
request
*
Curl
JS
Ruby
Python
Responses
200
400
401
503