net.corda.node.api / APIServer

# APIServer

`interface APIServer`

Top level interface to external interaction with the distributed ledger.

Wherever a list is returned by a fetchXXX method that corresponds with an input list, that output list will have optional elements where a null indicates "missing" and the elements returned will be in the order corresponding with the input list.

### Functions

buildTransaction | `abstract fun buildTransaction(type: ContractDefRef, steps: List<TransactionBuildStep>): SerializedBytes<WireTransaction>` TransactionBuildSteps would be invocations of contract.generateXXX() methods that all share a common TransactionBuilder and a common contract type (e.g. Cash or CommercialPaper) which would automatically be passed as the first argument (wed need that to be a criteria/pattern of the generateXXX methods).
commitTransaction | `abstract fun commitTransaction(tx: SerializedBytes<WireTransaction>, signatures: List<WithKey>): SecureHash` Attempt to commit transaction (returned from build transaction) with the necessary signatures for that to be successful, otherwise exception is thrown.
fetchProtocolsRequiringAttention | `abstract fun fetchProtocolsRequiringAttention(query: StatesQuery): Map<StateRef, ProtocolRequiringAttention>` Fetch protocols that require a response to some prompt/question by a human (on the "bank" side).
fetchStates | `abstract fun fetchStates(states: List<StateRef>): Map<StateRef, TransactionState<ContractState>?>`
fetchTransactions | `abstract fun fetchTransactions(txs: List<SecureHash>): Map<SecureHash, SignedTransaction?>` Query for immutable transactions (results can be cached indefinitely by their id/hash).
generateTransactionSignature | `abstract fun generateTransactionSignature(tx: SerializedBytes<WireTransaction>): WithKey` Generate a signature for this transaction signed by us.
info | `abstract fun info(): NodeInfo` Report this nodes configuration and identities. Currently tunnels the NodeInfo as an encoding of the Kryo serialised form. TODO this functionality should be available via the RPC
invokeProtocolSync | `abstract fun invokeProtocolSync(type: ProtocolRef, args: Map<String, Any?>): Any?` This method would not return until the protocol is finished (hence the "Sync").
provideProtocolResponse | `abstract fun provideProtocolResponse(protocol: ProtocolInstanceRef, choice: SecureHash, args: Map<String, Any?>): Unit` Provide the response that a protocol is waiting for.
queryStates | `abstract fun queryStates(query: StatesQuery): List<StateRef>` Query your "local" states (containing only outputs involving you) and return the hashes & indexes associated with them to probably be later inflated by fetchLedgerTransactions() or fetchStates() although because immutable you can cache them to avoid calling fetchLedgerTransactions() many times.
serverTime | `abstract fun serverTime(): LocalDateTime` Report current UTC time as understood by the platform.
status | `abstract fun status(): <ERROR CLASS>` Report whether this node is started up or not.

### Inheritors

APIServerImpl | `class APIServerImpl : APIServer`