Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ti-infinite/GSMApplication/llms.txt

Use this file to discover all available pages before exploring further.

Transactions are the core operational record in the GSM Operations service. Each transaction is identified by a TrxPrefix that encodes the business context — for example, PRDLBR indicates a productivity-labor transaction. A transaction progresses through a defined lifecycle: it is initially CREATED, transitions to INPROGRESS when work begins, and is ultimately resolved as either COMPLETED or CANCELLED. State changes are recorded as entries in the TrxStates collection, providing a complete audit trail. Each transaction can carry arbitrary key/value attributes (TrxAttributes), associated product lines (TrxProducts), and typed detail lines (TrxDetails), making the structure flexible enough to represent diverse operational workflows without schema changes.

Create Transaction

Create a new transaction header with its initial state, attributes, products, and detail lines.

Endpoint

POST /api/operations/v1/operations/create-trx

Authentication

Authorization
string
required
Bearer token. Format: Bearer <token>

Request Body

trxPrefix
string
required
Business-type prefix that classifies the transaction. This value determines processing rules and reporting groupings. Example values: PRDLBR (productivity-labor), RCVHB (herb receipt), DSPHB (herb dispatch).
descr
string
Optional free-text description for the transaction.
username
string
required
Username of the operator creating the transaction. Used for audit trail purposes.
location
string
Optional physical location or site identifier where the transaction originates.
trxAttributes
array
Arbitrary key/value metadata attached to the transaction. Can be used to store custom attributes without modifying the schema.
trxProducts
array
Product lines included in the transaction.
trxStates
object
required
The initial state record for the transaction.
trxDetails
array
required
Typed detail lines that carry the transaction’s operational data.

HTTP Status Codes

CodeMeaning
200 OKTransaction created. data contains confirmation (typically the new TrxDocument identifier).
400 Bad RequestRequired fields missing or validation failed.
401 UnauthorizedToken missing or invalid.

Example

curl --request POST \
  --url 'https://your-gateway.example.com/api/operations/v1/operations/create-trx' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "trxPrefix": "PRDLBR",
    "descr": "Morning harvest labor record",
    "username": "jsmith",
    "location": "Farm A - Block 3",
    "trxAttributes": [
      { "attributeKey": "SHIFT", "attributeValue": "MORNING" }
    ],
    "trxProducts": [
      { "idVariety": 10, "varietyName": "Lavender Fine", "sku": "LAV-001-F", "qty": 25.5 }
    ],
    "trxStates": {
      "trxState": "CREATED",
      "comments": "Initial record",
      "stateDate": "2024-06-01T07:00:00Z"
    },
    "trxDetails": [
      { "detailType": "EMPLOYEE", "detailValue": "EMP-042" },
      { "detailType": "NOTE", "detailValue": "Harvested from east quadrant." }
    ]
  }'
{
  "success": true,
  "message": "Transaction created successfully.",
  "data": "PRDLBR-20240601-0001",
  "errorType": null,
  "traceId": "00-3c4d5e6f7a8b9c01-01",
  "details": null
}

Update Transaction

Apply a partial update to an existing transaction. Only the collections provided in the body are updated; omitted collections remain unchanged.

Endpoint

PATCH /api/operations/v1/operations/{idTrxHeader}

Path Parameters

idTrxHeader
integer (long)
required
The numeric ID of the transaction header to update.

Request Body

trxAttributes
array
Updated or additional key/value attribute lines.
trxProducts
array
Updated product lines.
trxStates
object
New state entry to append to the transaction’s state history. Use this to advance the lifecycle (e.g. from INPROGRESS to COMPLETED).
trxDetails
array
Updated or appended detail lines.

HTTP Status Codes

CodeMeaning
200 OKTransaction updated successfully.
400 Bad RequestValidation failed (e.g. invalid state transition).
401 UnauthorizedToken missing or invalid.
404 Not FoundNo transaction found with the given idTrxHeader.

Example

curl --request PATCH \
  --url 'https://your-gateway.example.com/api/operations/v1/operations/1001' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "trxStates": {
      "trxState": "COMPLETED",
      "comments": "Harvest completed and verified.",
      "stateDate": "2024-06-01T14:30:00Z"
    }
  }'

Search Transactions

Search and retrieve transactions matching the specified filter criteria.

Endpoint

POST /api/operations/v1/operations/getTrx

Authentication

Authorization
string
required
Bearer token. Format: Bearer <token>

Request Body

trxPrefix
string
Filter by transaction type prefix (e.g. "PRDLBR"). Returns only transactions of this type.
status
string
Filter by current transaction status. Standard values: CREATED, INPROGRESS, COMPLETED, CANCELLED.
location
string
Filter by originating location.

Response

data
array
List of matching transaction records.

HTTP Status Codes

CodeMeaning
200 OKTransactions returned (may be empty list).
400 Bad RequestInvalid search criteria.
401 UnauthorizedToken missing or invalid.

Example

curl --request POST \
  --url 'https://your-gateway.example.com/api/operations/v1/operations/getTrx' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "trxPrefix": "PRDLBR",
    "status": "COMPLETED",
    "location": "Farm A - Block 3"
  }'
{
  "success": true,
  "message": "Transactions retrieved.",
  "data": [
    {
      "idTrxHeader": 1001,
      "trxPrefix": "PRDLBR",
      "trxDocument": "PRDLBR-20240601-0001",
      "descr": "Morning harvest labor record",
      "trxDate": "2024-06-01T07:00:00Z",
      "status": "COMPLETED",
      "username": "jsmith",
      "location": "Farm A - Block 3",
      "trxAttributes": [
        { "idTrxAttribute": 1, "attributeKey": "SHIFT", "attributeValue": "MORNING" }
      ],
      "trxProducts": [
        { "idTrxProduct": 1, "idVariety": 10, "varietyName": "Lavender Fine", "sku": "LAV-001-F", "qty": 25.5 }
      ],
      "trxStates": [
        { "idTrxState": 1, "trxState": "CREATED", "stateDate": "2024-06-01T07:00:00Z", "comments": "Initial record" },
        { "idTrxState": 2, "trxState": "COMPLETED", "stateDate": "2024-06-01T14:30:00Z", "comments": "Harvest completed and verified." }
      ],
      "trxDetails": [
        { "idTrxDetail": 1, "detailType": "EMPLOYEE", "detailValue": "EMP-042" }
      ]
    }
  ],
  "errorType": null,
  "traceId": null,
  "details": null
}

Transaction Lifecycle

Transactions follow a linear state machine. State transitions are appended to the trxStates collection — the current status of the transaction is always the most recently recorded state.
CREATED → INPROGRESS → COMPLETED
                    ↘ CANCELLED
StateDescription
CREATEDTransaction has been recorded but work has not started.
INPROGRESSWork is actively under way.
COMPLETEDWork finished successfully and the transaction is closed.
CANCELLEDTransaction was abandoned before completion.

TrxPrefix Convention

The trxPrefix value encodes the business type of the transaction. Prefixes are configured per tenant and drive processing rules, reporting, and integrations. Common examples:
PrefixDescription
PRDLBRProductivity — labor-based harvest recording
RCVHBReceipt of herb inventory
DSPHBDispatch of herb inventory

Build docs developers (and LLMs) love