REST API

You can access the Rest API through the Swagger UI from the App API section. Navigate to Network -> Deployed Apps -> App -> Rest API

base url: 

https://<membership_id>.spydra.app/fabric/<app_id>

Get the base URL from Network -> Deployed Apps -> App -> Rest API page.
Select your organization at the top right of this page.

Alternatively, you can from the URL by getting the <membership_id> by navigating
to Network -> Members page and getting the <app_id> by navigating to the Network -> 
Deployed Apps -> App Overview page.

post

Create a transaction on the blockchain

Authorizations
X-API-KEYstringRequired
Query parameters
asyncstringOptional

Whether to wait for the transaction to be created before returning a response or not. When async=false (default), the API will wait for the transaction to be committed on the Ledger and then return the transaction Id. If async=true, the API will return immediately with a receipt Id. The reciept Id can be used to check the status of the transaction anytime using the /receipt endpoint.

Body
functionNamestringOptionalExample: CreateDocumentDefinitions
Responses
200

Transaction created

application/json
Responseone of
or
post
/ledger/transact
POST /fabric/<chaincodeccid>/ledger/transact HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 106

{
  "functionName": "CreateDocumentDefinitions",
  "args": [
    {
      "id": "Invoice",
      "name": "Invoice",
      "idAttribute": "id"
    }
  ]
}
{
  "transactionId": "dd7817b56429532ceea32e2111faa20a7af87c945e7d8163ae2384c560b565f2",
  "receiptId": "643d316fa27b8c7dcdb31c49"
}
post

Queries/Evaluate the transaction on the blockchain

Authorizations
X-API-KEYstringRequired
Body
functionNamestringOptionalExample: CreateDocumentDefinitions
Responses
200

Transaction queried

application/json
post
/ledger/query
POST /fabric/<chaincodeccid>/ledger/query HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 106

{
  "functionName": "CreateDocumentDefinitions",
  "args": [
    {
      "id": "Invoice",
      "name": "Invoice",
      "idAttribute": "id"
    }
  ]
}
[
  {
    "ID": "asset1",
    "Color": "whte",
    "Size": 15,
    "Owner": "Brad",
    "AppraisedValue": 200
  }
]
post

Issues the identity from the certificate authority

Authorizations
X-API-KEYstringRequired
Body
enrollmentIdstringOptionalExample: user1
typestringOptionalExample: client
maxEnrollmentsnumberOptionalExample: 10
Responses
post
/identity
POST /fabric/<chaincodeccid>/identity HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 105

{
  "enrollmentId": "user1",
  "type": "client",
  "maxEnrollments": 10,
  "attributes": {
    "userEmail": "[email protected]"
  }
}
{
  "key": "-----BEGIN PRIVATE KEY-----\r\nMIGHAgEAMBM-\n----END PRIVATE KEY-----\r\n",
  "certificate": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgA\n-----END CERTIFICATE-----\n",
  "rootCertificate": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgA\n-----END CERTIFICATE-----\n"
}
patch

ReIssue the identity from the certificate authority

Authorizations
X-API-KEYstringRequired
Path parameters
enrollmentIdstringRequired
Responses
patch
/identity/{enrollmentId}
PATCH /fabric/<chaincodeccid>/identity/{enrollmentId} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "key": "-----BEGIN PRIVATE KEY-----\r\nMIGHAgEAMBM-\n----END PRIVATE KEY-----\r\n",
  "certificate": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgA\n-----END CERTIFICATE-----\n",
  "rootCertificate": "-----BEGIN CERTIFICATE-----\nMIICjDCCAjKgA\n-----END CERTIFICATE-----\n"
}
get

Get the identity from the fabric certificate authority

Authorizations
X-API-KEYstringRequired
Path parameters
enrollmentIdstringRequired
Responses
200

Fetched Identity

application/json
get
/identity/{enrollmentId}
GET /fabric/<chaincodeccid>/identity/{enrollmentId} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "id": "user1",
  "type": "client",
  "affiliation": "",
  "attrs": [
    {
      "name": "user1",
      "value": "123",
      "ecert": true
    }
  ],
  "max_enrollments": 10,
  "caname": "ca-org1"
}
delete

Revoke the identity from the certificate authority

Authorizations
X-API-KEYstringRequired
Path parameters
enrollmentIdstringRequired
Body
reasonstringOptionalExample: keycompromise
generateCRLbooleanOptional
Responses
delete
/identity/{enrollmentId}
DELETE /fabric/<chaincodeccid>/identity/{enrollmentId} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 45

{
  "reason": "keycompromise",
  "generateCRL": true
}
{
  "revokeUser": {
    "RevokedCerts": [
      {
        "Serial": "3bf5b6",
        "AKI": "3bf5b6"
      }
    ],
    "CRL": ""
  },
  "generatedCRL": "LS0tLS1CRUd"
}
get

Get all identities from the certificate authority

Authorizations
X-API-KEYstringRequired
Responses
200

Identities

application/json
get
/identity/all
GET /fabric/<chaincodeccid>/identity/all HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
[
  {
    "id": "user1",
    "type": "client",
    "affiliation": "",
    "attrs": [
      {
        "name": "user1",
        "value": "123",
        "ecert": true
      }
    ],
    "max_enrollments": 10,
    "caname": "ca-org1"
  }
]
get

Get Fabric Chain Information

Authorizations
X-API-KEYstringRequired
Responses
200

ChainInfo

application/json
get
/explorer/chainInfo
GET /fabric/<chaincodeccid>/explorer/chainInfo HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "height": "109",
  "currentBlockHash": "lXNu1mBUNpNAUzucy/2CAsk0Hq586+8WRO",
  "previousBlockHash": "Gob0PD5UgI38BwEQT+baD+8ei92WBbY"
}
get

Get Blockchan Block for a Number

Authorizations
X-API-KEYstringRequired
Path parameters
blockNumbernumberRequired
Responses
200

Block data

application/json
get
/explorer/block/byNumber/{blockNumber}
GET /fabric/<chaincodeccid>/explorer/block/byNumber/{blockNumber} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "header": {
    "number": 10,
    "previous_hash": "\u0014����2�S�q\u001ck��h",
    "data_hash": "I\u0006(p�o\u0013"
  },
  "data": {
    "data": [
      {
        "signature": "I\u0006(p�o\u0014",
        "payload": {}
      }
    ]
  },
  "metadata": {
    "metadata": [
      {
        "value": "II\u0006(p�o\u0014345",
        "signatures": [
          {}
        ]
      }
    ]
  }
}
get

Get Blockchan Block for a TransactionId

Authorizations
X-API-KEYstringRequired
Path parameters
transactionIdstringRequired
Responses
200

Block data

application/json
get
/explorer/block/byTxId/{transactionId}
GET /fabric/<chaincodeccid>/explorer/block/byTxId/{transactionId} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "header": {
    "number": 10,
    "previous_hash": "\u0014����2�S�q\u001ck��h",
    "data_hash": "I\u0006(p�o\u0013"
  },
  "data": {
    "data": [
      {
        "signature": "I\u0006(p�o\u0014",
        "payload": {}
      }
    ]
  },
  "metadata": {
    "metadata": [
      {
        "value": "II\u0006(p�o\u0014345",
        "signatures": [
          {}
        ]
      }
    ]
  }
}
get

Get Blockchan Transaction for a TransactionId

Authorizations
X-API-KEYstringRequired
Path parameters
transactionIdstringRequired
Responses
200

Transaction data

application/json
get
/explorer/transaction/byTxId/{transactionId}
GET /fabric/<chaincodeccid>/explorer/transaction/byTxId/{transactionId} HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "validationCode": 0,
  "data": {
    "signature": "I\u0006(p�o\u0014",
    "payload": {
      "header": {},
      "data": {}
    }
  },
  "transaction_hash": "dd81d0c67b75fe16c30fa113e1b3ef020cb9e92",
  "created_date": "2023-05-16T11:39:46.499Z",
  "transaction_type": "ENDORSER_TRANSACTION",
  "chaincode_name": "document-contract",
  "block_number": {
    "low": 50,
    "high": 0,
    "unsigned": true
  },
  "msp_id": "Org1"
}
get

Get latest Blocks

Authorizations
X-API-KEYstringRequired
Query parameters
limitstringOptional
bookmarkstringOptional
Responses
200

Block data

application/json
get
/explorer/block/latest
GET /fabric/<chaincodeccid>/explorer/block/latest HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "records": [
    {
      "header": {
        "number": 10,
        "previous_hash": "\u0014����2�S�q\u001ck��h",
        "data_hash": "I\u0006(p�o\u0013"
      },
      "data": {
        "data": [
          {
            "signature": "I\u0006(p�o\u0014",
            "payload": {}
          }
        ]
      },
      "metadata": {
        "metadata": [
          {
            "value": "II\u0006(p�o\u0014345",
            "signatures": [
              {}
            ]
          }
        ]
      }
    }
  ],
  "bookmark": 8,
  "count": 2
}
get

Get latest Transactions

Authorizations
X-API-KEYstringRequired
Query parameters
limitstringOptional
bookmarkstringOptional
block_numberstringOptional
Responses
200

Transaction data

application/json
get
/explorer/transaction/latest
GET /fabric/<chaincodeccid>/explorer/transaction/latest HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "records": [
    {
      "block_number": 8,
      "data": {
        "signature": "I\u0006(p�o\u0014",
        "payload": {
          "header": {},
          "data": {}
        }
      },
      "transaction_hash": "dd81d0c67b75fe16c30fa113e1b3ef020cb9e92",
      "created_date": "2023-05-16T11:39:46.499Z",
      "transaction_type": "ENDORSER_TRANSACTION",
      "chaincode_name": "document-contract",
      "msp_id": "Org1"
    }
  ],
  "bookmark": "99_dd81d0c67b75fe16c30fa113e1b3ef020cb9e",
  "count": 2,
  "nextTransactionsExist": false
}
get

Get the status of an already submitted transaction using the returned receipt id.

Authorizations
X-API-KEYstringRequired
Query parameters
receiptIdstringRequired

The receipt id returned while submitting the transaction.

Responses
200

Transaction found.

application/json
get
/receipt
GET /fabric/<chaincodeccid>/receipt?receiptId=text HTTP/1.1
Host: <networkorgid>.<publicdomain>
X-API-KEY: YOUR_API_KEY
Accept: */*
{
  "transactionId": "6c94ff55155722c28611630e7d6795145e0282e9fabf10bf3460f396e2a6218b",
  "status": "COMMITTED",
  "message": "Success"
}

Last updated

Was this helpful?