Fluent Commerce Logo
Docs
Sign In

User Action API

Essential knowledge

Author:

Fluent Commerce

Changed on:

24 Oct 2023

Overview

The User Action API provides the framework to interact with orchestration via the ServicePoint and Admin Console platform portals, as well as the capability to interact with various other external applications. This interaction provides the capability to translate unique requirements into a user interface.

Key points

  • Operations
  • Models

Property

Value

URL

`<root_url>/api/v4.1/transition`

Methods

`POST`

Scheme

`HTTP/1.1`

Auth

`Bearer null`

Content-Type

`application/json`

Operations

[POST]    /transition    Get available user actions with the provided triggers

Authentication

Required

Parameters

Name

Description

body *required

The Location object that needs to be created

Responses

Response Content Type: 

`application/json`

Code

Description

200

Successful Operation

400

Client Error - Bad Request

401

Authorization Error - Invalid Bearer Token / No permission

403

Authorization Error - Forbidden

404

Client Error - Not Found

500

Server Error

Example

Request:

`https://<AccountId>.sandbox.api.fluentretail.com/api/v4.1/transition`

1{
2    "triggers":[
3        {
4            "type":"MANIFEST",
5            "subtype":"DEFAULT",
6            "status":"PENDING",
7            "retailerId":"2",
8            "module":"servicepoint",
9            "flexType":"CARRIER::DEFAULT",
10            "flexVersion":14
11        }
12    ]
13}

Language: json

Name: Example Request Body

Description:

[Warning: empty required content area]
1{
2    "response": [
3        {
4            "trigger": {
5                "name": null,
6                "type": "MANIFEST",
7                "subtype": "DEFAULT",
8                "status": "PENDING",
9                "module": "servicepoint",
10                "flexType": "CARRIER::DEFAULT",
11                "flexVersion": null,
12                "retailerId": "2"
13            },
14            "userActions": [
15                {
16                    "eventName": "UPDATE",
17                    "context": [
18                        {
19                            "label": "SUBMIT",
20                            "type": "PRIMARY",
21                            "modules": [
22                                "servicepoint"
23                            ],
24                            "confirm": false
25                        }
26                    ],
27                    "attributes": []
28                }
29            ],
30            "transitions": [
31                {
32                    "eventName": "UPDATE",
33                    "context": [
34                        {
35                            "label": "SUBMIT",
36                            "type": "PRIMARY",
37                            "modules": [
38                                "servicepoint"
39                            ],
40                            "confirm": false
41                        }
42                    ],
43                    "attributes": []
44                }
45            ]
46        }
47    ]
48}

Language: json

Name: Example Success Response

Description:

[Warning: empty required content area]
1{
2    "errors": [
3        {
4            "code": "401",
5            "message": "Invalid user, Authorization header value does not belong to a valid user"
6        }
7    ]
8}

Language: json

Name: Example Error Response

Description:

[Warning: empty required content area]

Models

User Action Request Model

Key

Type

Mandatory?

Possible Values

Constraints

Description

triggers

TriggerRequest[]



List of triggers that match the associated user-action

Trigger Request Model

Key

Type

Mandatory?

Possible Values

Constraints

Description

name

String



Event name

type

String



Entity type

subtype

String



Entity subtype

status

String



Entity status - if no status is used, all user actions belonging to any status will be returned.

retailerId

String



Retailer ID

module

String


Case-sensitive

Filter user-action by applicable module (e.g. "servicepoint" or more specifically "servicepoint.arrivals", "adminconsole", or "SFSC"). Value for the module is customizable.

flexType

String



Specify the type of workflow to request the user action

flexVersion

String



Specify the version of the workflow to request the user actions from, if left out will retrieve the latest workflow version.

Response Model

Key

Type

Mandatory?

Possible Values

Default Value

Description

response

UserAction[]




List of user-action responses

UserActionResponse






trigger

TriggerRequest




Trigger Request. Refer to the Trigger Request model above

userActions

UserAction[]




List of user actions associated with the corresponding trigger

UserAction






eventName

String




Name of the event to send when action is invoked

context

Context[]




Details about how and where to show the user action in the UI

attributes

Attribute[]




List of any attributes that need to be attached to the event to invoke this user action

Context






type

String


PRIMARY, SECONDARY


Type of the user-action. Defines how and where this user-action should appear in the UI

label

String




Label to appear on the button to trigger this user-action

modules

String[]



all

List of modules in which the user action is configured to appear

style

String




Additional style flags for the user action (to change coloring, show/hide elements in the modal, etc). Generally used as CSS class names

confirm

Boolean



false

Enforce a "confirm" modal before invoking a user-action event, even if the user-action requires no attributes

Attribute






name

String




The name under which this attribute should be attached to the user-action event

label

String




UI label for the form element

type

String, Address, OrderItem, Product




Type of attribute (and therefore the form element that should be displayed)

mandatory

Boolean



true

Whether this attribute is required on the event

value

Object




If the value is present, use this value as the attribute value when submitting the event. Do not show a form element for this attribute. This is used to "lock in" some elements, for example, a "Cancel as Broken" button might lock "cancellationReason" to "BROKEN"

defaultValue

Object




Default value to use in the form when applicable

source

String




Defines a source to retrieve valid values for this attribute (e.g. "settings.cancellationReasons") where there is a limited subset

options

Object




When source references an internal settings value, options will be populated by the API

extensions

Object




Stores additional information needed for this an attribute



Fluent Commerce

Fluent Commerce