Http api.localhost assets front_top truyencotich_002.png
This page assumes you already know an API Root URL for a BigchainDB node or reverse proxy. It should be something like Show GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 5 or GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 6. If you set up a BigchainDB node or reverse proxy yourself, and you’re not sure what the API Root URL is, then see the last section of this page for help. BigchainDB Root URLIf you send an HTTP GET request to the BigchainDB Root URL e.g. GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 7 or GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 5 (with no GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 9 on the end), then you should get an HTTP response with something like the following in the body: HTTP/1.1 200 OK Content-Type: application/json { "api": { },
"docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/",
"software": "BigchainDB",
"version": "2.2.1"
}API Root EndpointIf you send an HTTP GET request to the API Root Endpoint e.g. HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}0 or HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}1, then you should get an HTTP response that allows you to discover the BigchainDB API endpoints: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } TransactionsNote If you want to do more sophisticated queries than those provided by the BigchainDB HTTP API, then one option is to connect to MongoDB directly (if possible) and do whatever queries MongoDB allows. For more about that option, see the page about querying BigchainDB. HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}3 Get the transaction with the ID HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}4. If a transaction with ID HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}4 has been included in a committed block, then this endpoint returns that transaction, otherwise the response will be HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}6. Parameters:
Example request: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com Example response: HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}Response Headers:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}9 Requests to the GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 0 endpoint without any query parameters will get a response status code GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 1. HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 3 Get a list of transactions that use an asset with the ID GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4. If GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 5 is GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 6, then the CREATE transaction which created the asset with ID GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4 will be returned. If GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 5 is GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 9, then every TRANSFER transaction involving the asset with ID GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4 will be returned. This allows users to query the entire history or provenance of an asset. If GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 5 is not included, then every transaction involving the asset with ID GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4 will be returned. if HTTP/1.1 200 OK Content-Type: application/json [{ "asset": { },
"id": "79ef6803210c941903d63d08b40fa17f0a5a04f11ac0ff04451553a187d97a30",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
},
{
"asset": { },
"id": "1fec726a3b426498147f1a1f19a92c187d551a7f66db4b88d666d7dcc10e86a4",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
}]3 is set to HTTP/1.1 200 OK Content-Type: application/json [{ "asset": { },
"id": "79ef6803210c941903d63d08b40fa17f0a5a04f11ac0ff04451553a187d97a30",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
},
{
"asset": { },
"id": "1fec726a3b426498147f1a1f19a92c187d551a7f66db4b88d666d7dcc10e86a4",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
}]4, only the last transaction is returned instead of all transactions with the given GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4. This endpoint returns transactions only if they are in committed blocks. Query Parameters:
Example request: GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com Example response: HTTP/1.1 200 OK Content-Type: application/json [{ "asset": { },
"id": "79ef6803210c941903d63d08b40fa17f0a5a04f11ac0ff04451553a187d97a30",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
},
{
"asset": { },
"id": "1fec726a3b426498147f1a1f19a92c187d551a7f66db4b88d666d7dcc10e86a4",
"inputs": [ ],
"metadata": { },
"operation": "TRANSFER",
"outputs": [ ],
"version": "2.0"
}]Response Headers:
POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}3 POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}4 This endpoint is used to send a transaction to a BigchainDB network. The transaction is put in the body of the request. Query Parameters:
Once the posted transaction arrives at a BigchainDB node, that node will check to see if the transaction is valid. If it’s invalid, the node will return an HTTP 400 (error). Otherwise, the node will send the transaction to Tendermint (in the same node) using the . The meaning of the POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}9 query parameter is inherited from the mode parameter in . HTTP/1.1 202 Accepted Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}0 means the HTTP response will come back immediately, before Tendermint asks BigchainDB Server to check the validity of the transaction (a second time). HTTP/1.1 202 Accepted Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}1 means the HTTP response will come back after Tendermint gets a response from BigchainDB Server regarding the validity of the transaction. HTTP/1.1 202 Accepted Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 means the HTTP response will come back once the transaction is in a committed block. Note In the async and sync modes, after a successful HTTP response is returned, the transaction may still be rejected later on. All the transactions are recorded internally by Tendermint in WAL (Write-Ahead Log) before the HTTP response is returned. Nevertheless, the following should be noted:
Note The posted transaction should be valid. The relevant BigchainDB Transactions Spec explains how to build a valid transaction and how to check if a transaction is valid. One would normally use a driver such as the BigchainDB Python Driver to build a valid transaction. Note A client can subscribe to the WebSocket Event Stream API to listen for committed transactions. Example request: POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}Example response: HTTP/1.1 202 Accepted Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}Response Headers:
POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}3 HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}9 This endpoint (without any parameters) will push a new transaction. Since no POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}9 parameter is included, the default mode is assumed: POST /api/v1/transactions?mode=async HTTP/1.1 Host: example.com Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}5. Transaction OutputsThe HTTP/1.1 202 Accepted Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}9 endpoint returns transactions outputs filtered by a given public key, and optionally filtered to only include either spent or unspent outputs. Note If you want to do more sophisticated queries than those provided by the BigchainDB HTTP API, then one option is to connect to MongoDB directly (if possible) and do whatever queries MongoDB allows. For more about that option, see the page about querying BigchainDB. HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 GET /api/v1/outputs?public_key=1AAAbbb...ccc HTTP/1.1 Host: example.com 1 Get transaction outputs by public key. The GET /api/v1/outputs?public_key=1AAAbbb...ccc HTTP/1.1 Host: example.com 2 parameter must be a base58 encoded ed25519 public key associated with transaction output ownership. Returns a list of transaction outputs. Parameters:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 GET /api/v1/outputs?public_key=1AAAbbb...ccc HTTP/1.1 Host: example.com 8 Return all outputs, both spent and unspent, for the Example request: GET /api/v1/outputs?public_key=1AAAbbb...ccc HTTP/1.1 Host: example.com Example response: HTTP/1.1 200 OK Content-Type: application/json [ { },
{ }
]Status Codes:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json [ { },
{ }
]2 Return all spent outputs for Example request: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 0 Example response: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 1 Status Codes:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json [ { },
{ }
]6 Return all unspent outputs for Example request: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 2 Example response: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 3 Status Codes:
AssetsNote If you want to do more sophisticated queries than those provided by the BigchainDB HTTP API, then one option is to connect to MongoDB directly (if possible) and do whatever queries MongoDB allows. For more about that option, see the page about querying BigchainDB. HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 00 Return all the assets that match a given text search. Query Parameters:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 03 Return all assets that match a given text search. Example request: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 4 Example response: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 5 Response Headers:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 11 Return at most Example request: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 6 Example response: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 7 Response Headers:
ValidatorsHTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 16 Return the local validators set of a given node. Example request: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 8 Example response: HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 9 Response Headers:
BlocksHTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 19 Get the block with the height HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 20. Parameters:
Example request: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 0 Example response: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 1 Response Headers:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 25 The unfiltered HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 22 endpoint without any query parameters returns a GET /api/v1/transactions?operation=TRANSFER&asset_id=4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 1 status code. Example request: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 2 Example response: Status Codes:
HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}2 HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 31 Retrieve a list of block IDs (block heights), such that the blocks with those IDs contain a transaction with the ID HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}4. A correct response may consist of an empty list or a list with one block ID. Note In case no block was found, an empty list and an HTTP status code HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 33 is returned, as the request was still successful. Query Parameters:
Example request: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 3 Example response: GET /api/v1/transactions/4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317 HTTP/1.1 Host: example.com 4 Response Headers:
Determining the API Root URLWhen you start BigchainDB Server using HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 38, an HTTP API is exposed at some address. The default is: HTTP/1.1 200 OK Content-Type: application/json { "asset": { },
"id": "4957744b3ac54434b8270f2c854cc1040228c82ea4e72d66d2887a4d3e30b317",
"inputs": [ ],
"metadata": { },
"operation": "CREATE",
"outputs": [ ],
"version": "2.0"
}0 It’s bound to HTTP/1.1 200 OK Content-Type: application/json { "assets": "/assets/", "blocks": "/blocks/", "docs": "https://docs.bigchaindb.com/projects/server/en/v2.2.1/http-client-server-api.html", "metadata": "/metadata/", "outputs": "/outputs/", "streams": "ws://localhost:9985/api/v1/streams/valid_transactions", "transactions": "/transactions/", "validators": "/validators" } 40, so you can access it from the same machine, but it won’t be directly accessible from the outside world. (The outside world could connect via a SOCKS proxy or whatnot.) |