Query Atomic Transaction
get
/restproxy/api/v2/atomicTransactions/{globalTransactionId}
Query an atomic transaction. This endpoint is used to query the status of an atomic transaction by providing the global (atomic) transaction ID.
Request
Supported Media Types
- application/json
Path Parameters
-
globalTransactionId(required): string
Global transaction ID
Query Parameters
-
role: string
Which Hyperledger Fabric enrollment should be used
Response
Supported Media Types
- application/json
200 Response
Successful operation
Root Schema : schema
Type:
Show Source
object-
error:
string
-
result:
object atomicTransactionResults
-
returnCode(required):
string
Allowed Values:
[ "Success", "Failure" ]
Nested Schema : atomicTransactionResults
Type:
Show Source
object-
globalStatus:
string
Current Status of the atomic transaction
-
globalTxid:
string
Global Transaction ID
-
lrc:
object atomicTransactionLRCResults
-
transactions:
array transactions
Details of individual transactions processed
-
txStartTime:
string
Transaction execution start time
Nested Schema : atomicTransactionLRCResults
Type:
Show Source
object-
ethResp:
object atomicTransactionEthResponse
-
txStatus:
string
Current status of the LRC transaction
Nested Schema : atomicTransactionEthResponse
Type:
Show Source
object-
block:
integer
Block number of the committed transaction
-
error:
string
Error message in case of failures
-
txHex:
string
Hex string representing the transaction executed
Nested Schema : atomicTransactionIndividualResults
Type:
Show Source
object-
chaincode:
string
ID of the chaincode invoked
-
channel:
string
ID of the channel on which the transaction was invoked
-
commit:
object commit
Details on the commit phase of the transaction
-
prepare:
object prepare
Details on the prepare phase of the transaction
-
rollback:
object rollback
Details on the rollback phase of the transaction
-
txstatus:
string
Current status of the individual transaction
Nested Schema : commit
Type:
objectDetails on the commit phase of the transaction
Show Source
-
error:
string
Error message in case the transaction fails
-
txid:
string
Transaction ID for the commit phase
Nested Schema : prepare
Type:
objectDetails on the prepare phase of the transaction
Show Source
-
error:
string
Error message in case the transaction fails
-
txid:
string
Transaction ID for the prepare phase
Nested Schema : rollback
Type:
objectDetails on the rollback phase of the transaction
Show Source
-
error:
string
Error message in case the transaction fails
-
txid:
string
Transaction ID for the rollback phase
400 Response
Bad Request
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
objectError Information.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing.
-
message(required):
string
A human-readable error string.
401 Response
Unauthorized
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
objectError Information.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing.
-
message(required):
string
A human-readable error string.
403 Response
Forbidden
404 Response
Not Found
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
objectError Information.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing.
-
message(required):
string
A human-readable error string.
500 Response
Internal Server Error
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
objectError Information.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing.
-
message(required):
string
A human-readable error string.
Examples
This endpoint is used to query the status of an atomic transaction by providing the global (atomic) transaction ID.
The following example shows how to query an atomic transaction by submitting a GET request on the REST resource using cURL.
curl -v -X GET \ "https://<rest proxy of your blockchain instance>/api/v2/atomicTransactions/<global_transaction_id>" \ -H "Authorization: Bearer <OAuth_access_token>" \ -H "accept: application/json"
For example,
curl -v -X GET \ "https://myvm.oracle.com:10001/restproxy/api/v2/atomicTransactions/21438a99-9fd7-4f96-b0bf-259910a26006" \ -H "Authorization: Bearer mF_9.B5f-4.1JqM" \ -H "accept: application/json"
Example of the Response Body
The following example shows the contents of the response body in JSON format for a successful atomic transaction:
{
"returnCode": "Success",
"error": "",
"result": {
"transactions": [
{
"channel": "goods",
"chaincode": "obcs-marbles",
"txstatus": "Committed",
"prepare": {
"txid": "bb248ef3f948cb107417c3f66ea144910644dee8086a370d44687fd9fe262233"
},
"commit": {
"txid": "21068846ef85942f9df1ccfd27dcb95d509146c5a0d10c6366642215badcb3b4"
},
"rollback": {}
},
{
"channel": "wallet",
"chaincode": "obcs-example02",
"txstatus": "Committed",
"prepare": {
"txid": "08d03d7170e7f696c79da0aa60142bbfdc08b3d92cee0d9423983dd19caf809c"
},
"commit": {
"txid": "ef9d8a824631f9e671162b81c7d1617080746ef3897b029cfbef1cfd1594d0ab"
},
"rollback": {}
}
],
"globalStatus": "Success",
"globalTxid": "21438a99-9fd7-4f96-b0bf-259910a26006",
"txStartTime": "2022-08-15T16:16:19.2180799642"
}
}
In this case, the value returned for globalStatus is
Success, which indicates that all of the transactions that the
atomic transaction comprises were committed successfully.