Website logo
Docs
API Reference
Postman Collection
Release Notes
Navigate through spaces
⌘K
Overview
API Reference Overview
How to use the API 'Try It' feature
Authentication And Authorization (AAA) Service
Role Management
User Management
Authentication
Connection Management
Group Management
Participant Service
Tenant
Participant Type
Participant Type - Custom Code Config
Participant Type - Attributes Config
Participant Type - State Machine
Participant
Templates
Participant State
Participant - Batch Processing
Container Service
Container Type
Container Type - Custom Code Config
Container Type - Attributes Config
Container Type - State Machine Config
Container
Container State
Container Group
Container - Batch Processing
Dispatch Service
Job Type
Job Workflow
Job
Job - Config
Dispatch Type
Dispatch
Mobile APIs
Dispatch - Config
Ledger
Ledger in batch
Custom Code Config
Workflow Service
Execution Task
Changelog
Execution Macro
Execution Workflow
Execution Workflow Instance
Health Check
SDS Service
App
Vault
Data
File Management Service
Folders
Files
State Machine Service
State Machine Config
Entity
Events
Reasons
Instance State
Movement Tracking Service
Trace Data
Missing Sequence Numbers
Snapped Distance
IOT Device
Geofence
MTS Subscription
Entity Service
Entity Type
State Machine Config
Entity Instance
Entity Type - Custom Code Config
Entity Instance State
Templates
Entity - Batch Processing
Notification Service
App Notification
Filter
Event
Change Log
Location Service
Location
Country
State
City
Search
Order Service
Order Config
Order State Machine Configuration
Order State Machine Transition
Work Order State Machine Configuration
Work Order State Transition
Order
Batch Order
Custom Code Config
Plugin Callback
External Reference APIs
Work Order Config
Work Order Status
Plugins
PluginWorkflow
Address Service
Address Config
Address
User FPA
Users
Facility FPA
Facilities
Vehicle FPA
Vehicles
LogisticsOrder API
Order
Batch Order
AAA - External Authorizer
Authorization
Orchestrator
Plugins
PluginWorkflow
Rules
Get Entity Status
DLQ Service
Query & Listing
Default Plugins
Job Manager
Work Order Manager
Container Manager
Workflow Manager
Cancellation Manager
Scheduler Service
Scheduler Service
Docs powered by Archbee
State Machine Service
State Machine Config

Create a new state machine configuration

1min
POST

This API is for creating a new state-machine configuration (states, sub-states and state transition rules) of an entity type; e.g. users, bags, boxes, vehicles, etc. specified by entityType.

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 Name name of the 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.

  • Events: Specifies a list of events that can be applied on any instance of an entityType.

  • 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: 32pattern: Name can have alphabets and must be 3 to 16 characters long.
ㅤ↳defaultSubState*Represents default substate for this state.stringminLength: 3 maxLength: 32pattern: Name can have alphabets and must be 3 to 16 characters long.
ㅤ↳subStates*minItems: 1
ㅤ↳name*Name of the sub-state.stringminLength: 3 maxLength: 32pattern: 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: 32pattern: 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: 2Example- 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
EntityCode
*
Code of an entity.
HEADER PARAMETERS
X-COREOS-REQUEST-ID
string
*
Unique requestId
X-COREOS-TID
string
*
Tenant id
X-COREOS-ACCESS
string
*

core-os access token

X-COREOS-USERINFO
string

core-os user info token

BODY PARAMETERS
body
StateMachineRequest
*[All Of:StateMachineConfig]
State-machine configuration for the entity type
states
States
*
List of main states with its substates and transitions
terminalTTL
string
*
Represents time to live of an instance in transactional database after it has reached a terminal state.
callback
CallbackURL
Represents 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.
RESPONSES
200
OK
SuccessResponse
[All Of:ErrorResponseobject]
error
Error
*
Error Information
request
Request
*
data
object
400
Bad request - The server is unable to process the request due to something that is perceived to be a client error.
ErrorResponse
error
Error
*
Error Information
request
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.
ErrorResponse
error
Error
*
Error Information
request
Request
*
503
Server error - The server is not ready to handle the request. This could be due to maintenance downtime or system resource constraints.
ErrorResponse
error
Error
*
Error Information
request
Request
*




Updated 21 Sep 2023
Did this page help you?
PREVIOUS
Get File Status
NEXT
Get state-machine configuration of an entity type
Docs powered by Archbee