Tagged Data Operations
Tagged data are similar to prunable plain messages without a recipient, but with additional searchable metadata fields.
Download Tagged Data
Download tagged data as a file if it is still available.
Request:
requestType
isdownloadTaggedData
transaction
is the transaction ID of the tagged dataretrieve
istrue
to retrieve pruned data from other nodes if not available (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response: The downloaded data file named nxt
, unless there is an error in the request.
Example: Refer to Download Tagged Data example.
Extend Tagged Data
Extend the expiration time of already uploaded tagged data. POST only.
Request:
requestType
isextendTaggedData
transaction
is the transaction ID of the tagged datadata
is the tagged data (optional)file
is the pathname of a data file to upload (optional ifdata
provided)filename
name
description
tags
type
channel
isText
Note: The data
and metadata (filename
, name
, description
, tags
, type
, channel
and isText
) parameters can be omitted if the tagged data has not yet expired; otherwise, the tagged data can be restored to the blockchain only if these fields have exactly the same values as when the data was uploaded (refer to Upload Tagged Data).
Note: Anyone can submit an extension, not only the original uploader. Each extend transaction increases the expiration deadline by two weeks (24 hours on Testnet). Extending an existing tagged data from another account does not change the original submitter account ID by which it is indexed and searchable.
Response: Refer to Create Transaction Response.
Example: Refer to Extend Tagged Data example.
Get Account Tagged Data
Get all available tagged data uploaded by a given account in reverse chronological order.
Request:
requestType
isgetAccountTaggedData
account
is the account IDincludeData
istrue
to includedata
(optional)firstIndex
is a zero-based index to the first tagged data to retrieve (optional)lastIndex
is a zero-based index to the last tagged data to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
data
(A) is an array of tagged data objects (refer to Get Tagged Data withhash
omitted for details)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Account Tagged Data example.
Get All Tagged Data
Get all available tagged data in reverse chronological order.
Request:
requestType
isgetAllTaggedData
includeData
istrue
to includedata
(optional)firstIndex
is a zero-based index to the first tagged data to retrieve (optional)lastIndex
is a zero-based index to the last tagged data to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
data
(A) is an array of tagged data objects (refer to Get Tagged Data withhash
omitted for details)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get All Tagged Data example.
Get Channel Tagged Data
Get available tagged data by channel, optionally filtered by account, in reverse chronological order.
Request:
requestType
isgetChannelTaggedData
channel
is the channel stringaccount
is an account ID (optional)includeData
istrue
to includedata
(optional)firstIndex
is a zero-based index to the first tagged data to retrieve (optional)lastIndex
is a zero-based index to the last tagged data to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
data
(A) is an array of tagged data objects (refer to Get Tagged Data withhash
omitted for details)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Channel Tagged Data example.
Get Data Tag Count
Get the total number of distinct available data tags.
Request:
requestType
isgetDataTagCount
requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
numberOfDataTags
(N) is the total number of distinct data tagslastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Data Tag Count example.
Get Data Tags
Get the distinct tags of all available tagged data, with the number of uses of each tag, in order of number of uses, then alphabetical order.
Request:
requestType
isgetDataTags
firstIndex
is a zero-based index to the first tag to retrieve (optional)lastIndex
is a zero-based index to the last tag to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
tags
(A) is an array of tag objects including the fields:tag
(S) is a tag wordcount
(N) is the number of uses oftag
among all tagged data
lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Data Tags example.
Get Data Tags Like
Prefix search of available data tags, return in alphabetical order.
Request:
requestType
isgetDataTagsLike
tagPrefix
is the prefix to search for (2 character minimum) among all data tagsfirstIndex
is a zero-based index to the first tag to retrieve (optional)lastIndex
is a zero-based index to the last tag to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
tags
(A) is an array of tag objects including the fields:tag
(S) is a tag wordcount
(N) is the number of uses oftag
among all tagged data
lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Data Tags Like example.
Get Tagged Data
Get available tagged data given a transaction ID.
Request:
requestType
isgetTaggedData
transaction
is the transaction IDincludeData
istrue
to includedata
(optional)retrieve
istrue
to retrieve pruned data from other nodes if not available (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
data
(S) is the tagged datahash
(S) is the hash of the tagged datafilename
(S) is the metadatafilename
fieldname
(S) is the metadataname
fielddescription
(S) is the metadatadescription
fieldtags
(S) is the metadatatags
fieldparsedTags
(A) is an array of tag words (S) parsed fromtags
type
(S) is the metadatatype
fieldchannel
(S) is the metadatachannel
fieldisText
(B) is the metadataisText
fieldaccount
(S) is the number of the account that originally uploaded the tagged dataaccountRS
(S) is the Reed-Solomon address of the uploading accounttransaction
(S) is the transaction IDtransactionTimestamp
(N) is the transaction timestamp (in seconds since the genesis block)blockTimestamp
(N) is the block timestamp (in seconds since the genesis block)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Note: Refer to Upload Tagged Data for details about the data
and metadata (filename
, name
, description
, tags
, type
, channel
and isText
) fields.
Example: Refer to Get Tagged Data example.
Get Tagged Data Extend Transactions
Retrieves all tagged data extend transactions for a given tagged data upload transaction.
Request:
requestType
isgetTaggedDataExtendTransactions
requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
extendTransactions
(A) is an array of transactionsrequestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Get Tagged Data Extend Transactions example.
Search Tagged Data
Full text search on available tagged data name, description and tags; optionally filtered by tag, channel or uploading account; return in reverse relevance order.
Request:
requestType
issearchTaggedData
query
is a full text query on the metadata fieldsname
(S),description
(S) andtags
(S) in the standard Lucene syntax (opens in a new tab)tag
is a word in thetags
string (optional)channel
is a channel string (optional)account
is an account ID (optional)includeData
istrue
to includedata
(optional)firstIndex
is a zero-based index to the first tagged data to retrieve (optional)lastIndex
is a zero-based index to the last tagged data to retrieve (optional)requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Response:
data
(A) is an array of tagged data objects (refer to Get Tagged Data withhash
omitted for details)lastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)
Example: Refer to Search Tagged Data example.
Upload Tagged Data
Upload and broadcast new tagged data. POST only.
Request: Refer to Create Transaction Request for common parameters.
requestType
isuploadTaggedData
data
is the data (optional)file
is the pathname of a data file to upload (optional ifdata
provided)filename
is a filename to associate withdata
(optional iffile
uploaded in which case the uploaded filename is always used)name
is the name or title ofdata
(optional iffile
uploaded in which case the uploaded filename is used, butname
takes precedence if provided)description
is a description ofdata
(optional)tags
is a list of up to 5 words from 3 to 20 characters long and separated by spaces and/or commas, describing the actual content ofdata
; for example:audio,mp3,classical
(optional)type
is the mime type ofdata
such astorrent
,pdf
,doc
,image
, etc. (optional)channel
is a data feed label such aspirate bay torrents
,wikileaks
, etc. (optional)isText
isfalse
ifdata
is a hex string (optional)
Note: The maximum length of data
plus all associated metadata is 42 kilobytes. The maximum length of description
is 1000 bytes. The maximum length of the other metadata (name
, tags
, type
, channel
and filename
) is 100 bytes each.
Response: Refer to Create Transaction Response.
Example: Refer to Upload Tagged Data example.
Verify Tagged Data
Verify expired tagged data downloaded from another node, against the hash in the blockchain.
Request:
requestType
isverifyTaggedData
transaction
is the transaction ID of the tagged datadata
is the tagged data (optional)file
is the pathname of a data file to upload (optional ifdata
provided)filename
name
description
tags
type
channel
isText
requireBlock
is the block ID of a block that must be present in the blockchain during execution (optional)requireLastBlock
is the block ID of a block that must be last in the blockchain during execution (optional)
Note: The data
and metadata (filename
, name
, description
, tags
, type
, channel
and isText
) must have exactly the same values as when the data was uploaded (refer to Upload Tagged Data).
Response:
verify
(B) istrue
if the hash of the provideddata
and metadata matches the hash in the blockchainhash
(S) is the hash of the tagged datalastBlock
(S) is the last block ID on the blockchain (applies ifrequireBlock
is provided but notrequireLastBlock
)requestProcessingTime
(N) is the API request processing time (in millisec)version.TaggedDataUpload
(N) is1
, the version number
Note: This call returns an error if there is a hash mismatch.
Example: Refer to Verify Tagged Data example.