Skip to content

Latest commit

 

History

History
358 lines (276 loc) · 13.1 KB

EntriesApi.md

File metadata and controls

358 lines (276 loc) · 13.1 KB

HarmonyConnectClient.EntriesApi

All URIs are relative to https://connect-shared-sandbox-2445582615332.production.gw.apicast.io/v1

Method HTTP request Description
getEntriesByChainID GET /chains/{chain_id}/entries Get Chain's Entries
getEntryByHash GET /chains/{chain_id}/entries/{entry_hash} Get Entry Info
getFirstEntry GET /chains/{chain_id}/entries/first Get Chain's First Entry
getLastEntry GET /chains/{chain_id}/entries/last Get Chain's Last Entry
postEntriesSearch POST /chains/{chain_id}/entries/search Search Chain's Entries
postEntryToChainID POST /chains/{chain_id}/entries Create an Entry

getEntriesByChainID

EntryList getEntriesByChainID(chainId, opts)

Get Chain's Entries

List all entries contained on the specified chain.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var opts = {
  'limit': 15, // Number | The number of items you would like back in each page.
  'offset': 2, // Number | The offset parameter allows you to select which item you would like to start from when you get back a list from Connect. For example, if you've already seen the first 15 items and you'd like the next set, you would send an offset of 15. `offset=0` starts from the first item of the set and is the default position.
  'stages': "stages_example" // String | The immutability stages you want to restrict results to. You can choose any from `replicated`, `factom`, and `anchored`. If you would like to search among multiple stages, send them in a comma separated string. For example: `'replicated,factom'`.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getEntriesByChainID(chainId, opts, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier
limit Number The number of items you would like back in each page. [optional]
offset Number The offset parameter allows you to select which item you would like to start from when you get back a list from Connect. For example, if you've already seen the first 15 items and you'd like the next set, you would send an offset of 15. `offset=0` starts from the first item of the set and is the default position. [optional]
stages String The immutability stages you want to restrict results to. You can choose any from `replicated`, `factom`, and `anchored`. If you would like to search among multiple stages, send them in a comma separated string. For example: `'replicated,factom'`. [optional]

Return type

EntryList

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getEntryByHash

Entry getEntryByHash(chainId, entryHash)

Get Entry Info

Returns information about a specific entry on Connect. The requested entry must be specified using the Chain ID and Entry Hash.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var entryHash = db; // String | The SHA256 hash of the entry.
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getEntryByHash(chainId, entryHash, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier
entryHash String The SHA256 hash of the entry.

Return type

Entry

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getFirstEntry

Entry getFirstEntry(chainId)

Get Chain's First Entry

Retrieve the first entry that has been saved to this chain.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getFirstEntry(chainId, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier

Return type

Entry

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getLastEntry

Entry getLastEntry(chainId)

Get Chain's Last Entry

Retrieve the last entry that has been saved to this chain.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getLastEntry(chainId, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier

Return type

Entry

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

postEntriesSearch

EntrySearchResponse postEntriesSearch(chainId, searchBody, opts)

Search Chain's Entries

Find all of the entries within the specified chain that have the requested `external_ids`.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var searchBody = new HarmonyConnectClient.SearchBody(); // SearchBody | 
var opts = {
  'limit': 15, // Number | The number of items you would like back in each page.
  'offset': 2 // Number | The offset parameter allows you to select which item you would like to start from when you get back a list from Connect. For example, if you've already seen the first 15 items and you'd like the next set, you would send an offset of 15. `offset=0` starts from the first item of the set and is the default position.
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.postEntriesSearch(chainId, searchBody, opts, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier
searchBody SearchBody
limit Number The number of items you would like back in each page. [optional]
offset Number The offset parameter allows you to select which item you would like to start from when you get back a list from Connect. For example, if you've already seen the first 15 items and you'd like the next set, you would send an offset of 15. `offset=0` starts from the first item of the set and is the default position. [optional]

Return type

EntrySearchResponse

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postEntryToChainID

EntryShort postEntryToChainID(chainId, entryCreate)

Create an Entry

Create a new entry for the selected chain. Content and external id must be uploaded in Base64 format.

Example

var HarmonyConnectClient = require('harmony-connect-client');
var defaultClient = HarmonyConnectClient.ApiClient.instance;
// Configure API key authorization: AppId
var AppId = defaultClient.authentications['AppId'];
AppId.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppId.apiKeyPrefix = 'Token';
// Configure API key authorization: AppKey
var AppKey = defaultClient.authentications['AppKey'];
AppKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//AppKey.apiKeyPrefix = 'Token';

var apiInstance = new HarmonyConnectClient.EntriesApi();
var chainId = 285904; // String | Chain identifier
var entryCreate = new HarmonyConnectClient.EntryCreate(); // EntryCreate | 
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.postEntryToChainID(chainId, entryCreate, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier
entryCreate EntryCreate

Return type

EntryShort

Authorization

AppId, AppKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json