nChain Event API Reference
V.1.4.3 API
V.1.4.3 API
  • About
  • Version History
  • API reference
    • Records
      • Status
      • Content
      • Match
    • Linkedrecords
      • Update
      • Delete
      • Status
      • Content
      • Match
      • Navigate
  • Specification
Powered by GitBook
On this page
  1. API reference
  2. Linkedrecords

Update

PreviousLinkedrecordsNextDelete

Update linked record

post

Update the supplied linked record by linking it to a new linked record transaction.

The transaction will be published to the blockchain asynchronously. Use Get linked record status to find out when it has been confirmed.

Path parameters
txIdstringRequired

The transaction id of the linked record to update.

Query parameters
encodestringRequired

Encode the record before registering on the blockchain. Available encoders depend upon your configuration options. Possible encoders include:

  • SHA256: Encode using SHA-2 256 *
  • Base64: Makes output human-readable
  • No specified encoder: the record is not encoded.

Note * A "salt" parameter may be specified in () brackets containing any of the following characters: ASCII letters and digits, "/", ":", "-" and "+" (URL encoded as "%2B"). The "salt" parameter will be prepended to the record before encoding.

Encoders may be combined using '|'. Example: SHA256(23:59:59.123)|Base64

updateTokenstringOptional

Optional, if specified it must be the updateToken returned from the creation of the supplied linked record.

Header parameters
x-api-keystringRequired

{your-API-key}

Body
string ยท byteOptional
Responses
200
The transaction has been published. The response is a JSON structure. It contains the following details: - txId: the transaction Id which is required by subsequent commands and can also be used by external tools - encoding: array of encoding steps (omitted when encoders are not used), each element defines: - contentType: output content type - output: if content type is a text, it will include up to 1024 characters of the output (omitted for other content types) - update_token: URL encoded(base64) JSON Structure containing: - key alias - key derivation path - locking script - output value
400
Invalid request. The Response is a JSON structure conforming to https://tools.ietf.org/html/rfc7807. It contains the following details: - errorCode: which can be one of: - CONTENT_LENGTH_LIMIT_EXCEEDED: Request body was bigger than configured limit for this service - CONTENT_BAD_ENCODER: Request was using encoder that is not allowed for this service instance - CONTENT_ENCODER_ARGUMENT_MISSING: Request was using encoder with missing argument that is not allowed for this service instance - ENCODE_PARAM_INVALID: Encode parameter does not resolve to a valid encoding specification - TX_HASH_PARM_INVALID: Provided transaction hash parameter is not a valid blockchain transaction hash - TX_NOT_AN_EVENT_TRANSACTION: Provided transaction hash is not nChain Event data transaction. This error cannot occur if updateToken is specified as there is no need to fetch the transaction in order to get information about chain output to use.Actual acceptance by the miner will probably still fail. - TX_NOT_LINKABLE: Transaction is not linkable - UPDATE_TOKEN_PARAM_INVALID: update_token request parameter is set to invalid value
404
The transaction cannot be read from the blockchain. It could either still be in the process of publishing or the blockchain has rejected it. This error cannot occur if updateToken is specified as there is no need to fetch the transaction in order to get information about the output link to use. Actual acceptance by the blockchain can still fail for the same reasons that fetching would fail.
500
An internal error occurred. Retry later. The Response is a JSON structure conforming to https://tools.ietf.org/html/rfc7807
post
POST /api/v1/linkedrecords/{txId}/update?encode=text HTTP/1.1
Host: {your-URL}
x-api-key: text
Content-Type: application/octet-stream
Accept: */*
Content-Length: 10

"Ynl0ZXM="
{
  "txId": "text",
  "updateToken": "text",
  "fingerprint": "Ynl0ZXM="
}