Transaction

List Transactions in Binder

Get all transactions in the binder identified by {binder_id}.

GET /{binder_id}/transactions

Sample Request
GET /CBD7zcTfnxwhr9ewgLEQ3h70/transactions
Sample Response
{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "transactions": [
            {
                "id": 617,
                "updated_time": 1525673277187,
                "created_time": 1525418033492,
                "title": "FD#12345678",
                "content": "Account: 1001\n amount 10,000",
                "steps": [
                    {
                        "id": 618,
                        "updated_time": 1525418033492,
                        "created_time": 1525418033492,
                        "action_style": "button",
                        "actions": [
                            {
                                "id": "Button1",
                                "text": "Decline",
                                "payload": "Cancelled",
                                "feed_msg": "Cancelled the transaction."
                            },
                            {
                                "id": "Button2",
                                "text": "Confirm",
                                "payload": "What ever need to pass when user click the button",
                                "feed_msg": "Confirmed the transaction.",
                                "style": "branding"
                            }
                        ],
                        "assignee": {
                            "user_id": "CUaZXaV3GzR97fcyoIIwrIH9",
                            "name": "bing127",
                            "email": "xbingxin127@126.com",
                            "org_id": "PqbOYAYDQKlGgBRvVQI8QR3",
                            "unique_id": ""
                        }
                    },
                    {
                        "id": 619,
                        "updated_time": 1525418033492,
                        "created_time": 1525418033492,
                        "action_style": "button",
                        "actions": [
                            {
                                "id": "Button1",
                                "text": "Decline",
                                "payload": "Cancelled",
                                "feed_msg": "Cancelled the transaction."
                            },
                            {
                                "id": "Button2",
                                "text": "Confirm",
                                "payload": "What ever need to pass when user click the button",
                                "feed_msg": "Confirmed the transaction.",
                                "style": "branding"
                            }
                        ],
                        "assignee": {
                            "user_id": "CUZjDYmXfckQ54p2keWxhSWJ",
                            "name": "Bingxin Xia"
                        }
                    }
                ],
                "display_status": {
                    "text": "Transaction status"
                },
                "creator": {
                    "id": "CUqNNqBMby1bJnDLdm6k38rF",
                    "name": "Bingxin Xia"
                }
            },
            {
                "id": 625,
                "updated_time": 1525660110971,
                "created_time": 1525660110971,
                "title": "New transaction need your confirmation",
                "content": "Account: 1001\n amount 10,000",
                "steps": [
                    {
                        "id": 626,
                        "updated_time": 1525660110971,
                        "created_time": 1525660110971,
                        "action_style": "button",
                        "actions": [
                            {
                                "id": "button_1",
                                "text": "Decline",
                                "payload": "Cancelled",
                                "feed_msg": "Cancelled the transaction."
                            },
                            {
                                "id": "button_2",
                                "text": "Confirm",
                                "payload": "What ever need to pass when user click the button",
                                "feed_msg": "Confirmed the transaction.",
                                "style": "branding"
                            }
                        ],
                        "assignee": {
                            "user_id": "CUqNNqBMby1bJnDLdm6k38rF",
                            "name": "Bingxin Xia",
                            "email": "bingxin.xia@moxtra.com",
                            "org_id": "PqbOYAYDQKlGgBRvVQI8QR3",
                            "unique_id": ""
                        }
                    },
                    {
                        "id": 627,
                        "updated_time": 1525660110971,
                        "created_time": 1525660110971,
                        "action_style": "button",
                        "actions": [
                            {
                                "id": "Button1",
                                "text": "Decline",
                                "payload": "Cancelled",
                                "feed_msg": "Cancelled the transaction."
                            },
                            {
                                "id": "Button2",
                                "text": "Confirm",
                                "payload": "What ever need to pass when user click the button",
                                "feed_msg": "Confirmed the transaction.",
                                "style": "branding"
                            }
                        ],
                        "assignee": {
                            "user_id": "CU1iXyW9we1LGPF106RkXuJE",
                            "name": "unique 2"
                        }
                    }
                ],
                "creator": {
                    "id": "CUqNNqBMby1bJnDLdm6k38rF",
                    "name": "Bingxin Xia"
                }
            }
        ]
    }
}

Create a Transaction

Create a transaction in the binder identified by {binder_id}.

POST /{binder_id}/transactions

JSON Parameters
Name Type Description
title String Transaction title
content String Content of transaction (support plain_text & rich_text)
assignee (In step) Object Step assignee
user_id (In assignee) String Optional: The user id who gets assigned
unique_id (In assignee) String Optional: The unique_id + org_id user who gets assigned
email (In assignee) String Optional: The email + org_id user who gets assigned
org_id (In assignee) String Optional: The unique_id + org_id or email + org_id user who gets assigned
order_number (In step) Number Optional: Step order number
action_style (In step) String Optional: Default is BUTTON
actions (In step) Array Actions of step
id (In action) String For action identification
text (In action) String Text display in action
payload (In action) String Payload content
feed_message (In action) String Feed message when current action triggered
style (In action) String Style to display
Sample Request
POST /B9rArkzRe094lPPiMH4UpS8/transactions
{
    "title" : "New transaction need your confirmation",
    "content": "Account: 1001\n amount 10,000",
    "steps" : [
        {
            "assignee": {
                "user_id": "CUqNNqBMby1bJnDLdm6k38rF"
            },
            "order_number": 1,
            "action_style": "button",
            "actions": [
                {
                    "id": "button_1",
                    "text": "Decline",
                    "payload": "Cancelled",
                    "feed_msg": "Cancelled the transaction."
                },
                {
                    "id": "button_2",
                    "text": "Confirm",
                    "payload": "What ever need to pass when user click the button",
                    "feed_msg": "Confirmed the transaction.",
                    "style": "branding"
                }
            ]
        },
        {
            "assignee": {
                "unique_id": "unique_id_2",
                "org_id": "PqbOYAYDQKlGgBRvVQI8QR3"
            },
            "order_number": 2,
            "actions": [
                {
                    "id": "Button1",
                    "text": "Decline",
                    "payload": "Cancelled",
                    "feed_msg": "Cancelled the transaction."
                },
                {
                    "id": "Button2",
                    "text": "Confirm",
                    "payload": "What ever need to pass when user click the button",
                    "feed_msg": "Confirmed the transaction.",
                    "style": "branding"
                }
            ]
        }
    ]
}
Sample Response
{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "transaction_id": 1759,
        "updated_time": 1537498495292,
        "created_time": 1537498495292,
        "steps": [
            {
                "id": 1760
            },
            {
                "id": 1761
            }
        ]
    }
}

Get a Transaction

Get a transaction identified by {binder_id} & {transaction_id}.

GET /{binder_id}/transactions/{transaction_id}

Sample Request
GET /CBunb6xqkxle4FfYCBTEs5Q6/transactions/24
Sample Response
{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "id": 24,
        "updated_time": 1525674262841,
        "created_time": 1525674262841,
        "title": "New transaction need your confirmation",
        "content": "Account: 1001\n amount 10,000",
        "steps": [
            {
                "id": 25,
                "updated_time": 1525674262841,
                "created_time": 1525674262841,
                "action_style": "button",
                "actions": [
                    {
                        "id": "button_1",
                        "text": "Decline",
                        "payload": "Cancelled",
                        "feed_msg": "Cancelled the transaction."
                    },
                    {
                        "id": "button_2",
                        "text": "Confirm",
                        "payload": "What ever need to pass when user click the button",
                        "feed_msg": "Confirmed the transaction.",
                        "style": "branding"
                    }
                ],
                "assignee": {
                    "user_id": "CUqNNqBMby1bJnDLdm6k38rF",
                    "name": "Bingxin Xia",
                    "email": "bingxin.xia@moxtra.com",
                    "org_id": "PqbOYAYDQKlGgBRvVQI8QR3",
                    "unique_id": ""
                }
            },
            {
                "id": 26,
                "updated_time": 1525674262841,
                "created_time": 1525674262841,
                "action_style": "button",
                "actions": [
                    {
                        "id": "Button1",
                        "text": "Decline",
                        "payload": "Cancelled",
                        "feed_msg": "Cancelled the transaction."
                    },
                    {
                        "id": "Button2",
                        "text": "Confirm",
                        "payload": "What ever need to pass when user click the button",
                        "feed_msg": "Confirmed the transaction.",
                        "style": "branding"
                    }
                ],
                "assignee": {
                    "user_id": "CU1iXyW9we1LGPF106RkXuJE",
                    "name": "unique 2"
                }
            }
        ],
        "creator": {
            "id": "CUqNNqBMby1bJnDLdm6k38rF",
            "name": "Bingxin Xia"
        }
    }
}

Update Transaction

Update the transaction identified by {binder_id} & {transaction_id}.

POST /{binder_id}/transactions/{transaction_id}

JSON Parameters
Name Type Description
title String Title of transaction
is_active Boolean Status of transaction
display_status Object Display_status of transaction
text(in display_status) String Text to show for display_status
style(in display_status) String Valid status are: SUCCESS, INFO, WARNING, DANGER

Sample Request
POST /B9rArkzRe094lPPiMH4UpS8/transactions/266
{
    "title": "FD#20180510001",
    "is_active": false,
    "display_status": {
        "style": "DANGER",
        "text": "notice"
    }
}
Sample Response
{
    "code": "RESPONSE_SUCCESS"
}

Update Transaction Step

Update the transaction step identified by {binder_id}, {transaction_id} & {step_id}. This is like the user performs the action via UI.

POST /{binder_id}/transactions/{transaction_id}/steps/{step_id}

JSON Parameters
Name Type Description
click_button_id String Click button id (when action_style is "BUTTON")

Sample Request
POST /CBD7zcTfnxwhr9ewgLEQ3h70/transactions/617/steps/618
{
  "click_button_id": "Button1"
}
Sample Response
{
    "code": "RESPONSE_SUCCESS"
}

Delete a Transaction

Delete a transaction identified by {binder_id} & {transaction_id}.

DELETE /{binder_id}/transactions/{transaction_id}

Sample Request
DELETE /CBunb6xqkxle4FfYCBTEs5Q6/transactions/24
Sample Response
{
    "code": "RESPONSE_SUCCESS"
}

Add comment to Transaction

Add comment to transaction identified by {binder_id}; for more details refer to Reply Message.

POST /{binder_id}/messages

Sample Request
POST /CBqXD6E6oLFCKd8fZjTNstGC/messages
{
    "reply_to": {
        "transaction": {
            "id": 41
        }
    },
    "message": {
        "text": "comment for transaction"
    }
}
Sample Response
{
    "code": "RESPONSE_SUCCESS",
    "data": {
        "binder_comment_id": 88
    }
}