Log Action & Events
How-to Guide
Author:
Fluent Commerce
Changed on:
13 Dec 2023
Key Points
- In the fluent platform, a log action allows to generate a specific log event when a rule executes.
Steps
include log action in the custom rule
The following sample code can be used on your custom rule to capture the details.
`context.action().log(message, detailedMessage, attributes);`
Run the following API call
The following API can be used to extract the data:
`{{fluentApiHost}}/api/v4.1/event?category=CUSTOM&from={{fromDate}}&to={{toDate}}&count={{count}}`
For example:
`{{fluentApiHost}}/api/v4.1/event?category=CUSTOM&from=2020-01-01T00:00:00.000Z&to=2020-01-01T23:59:59.999Z&count=1000`
Sample response
1{
2 "id": "c6c95950-4251-11ea-a739-cdcb79acb920",
3 "name": "CREATE_Log",
4 "type": "ORCHESTRATION_AUDIT",
5 "accountId": "TEST",
6 "retailerId": "1",
7 "category": "CUSTOM",
8 "context": {
9 "sourceEvents": [
10 "c6678a40-4251-11ea-b9f2-5fe6d7129603"
11 ],
12 "entityType": "ORDER",
13 "entityId": "180",
14 "entityRef": "CC_255",
15 "rootEntityType": "ORDER",
16 "rootEntityId": "180",
17 "rootEntityRef": "CC_255"
18 },
19 "eventStatus": "PENDING",
20 "attributes": [
21 {
22 "name": "action",
23 "value": "Sample Action",
24 "type": "STRING"
25 },
26 {
27 "name": "action",
28 "value": "CC_255",
29 "type": "STRING"
30 },
31 {
32 "name": "message",
33 "value": "Message",
34 "type": "STRING"
35 },
36 {
37 "name": "detailedMessage",
38 "value": "DetailedMessage",
39 "type": "STRING"
40 }
41 ],
42 "source": "plugin",
43 "generatedBy": "Rubix User",
44 "generatedOn": "2020-01-29T04:42:38.194+0000"
45}
Language: json
Name: sample result
Description:
[Warning: empty required content area]