Skip to content

Latest commit

 

History

History
240 lines (184 loc) · 9.42 KB

File metadata and controls

240 lines (184 loc) · 9.42 KB

HarmonyConnectClient.ChainsApi

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

Method HTTP request Description
getChainByID GET /chains/{chain_id} Get Chain Info
getChains GET /chains Get All Chains
postChain POST /chains Create a Chain
postChainSearch POST /chains/search Search Chains

getChainByID

Chain getChainByID(chainId)

Get Chain Info

Get information about a specific chain on Connect

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.ChainsApi();
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.getChainByID(chainId, callback);

Parameters

Name Type Description Notes
chainId String Chain identifier

Return type

Chain

Authorization

AppId, AppKey

HTTP request headers

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

getChains

ChainList getChains(opts)

Get All Chains

Returns all of the chains on factomd.

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.ChainsApi();
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.getChains(opts, callback);

Parameters

Name Type Description Notes
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

ChainList

Authorization

AppId, AppKey

HTTP request headers

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

postChain

ChainShort postChain(chainCreate)

Create a Chain

Create a new chain. Each chain functions as a mini-blockchain such that all of the entries are linked. Every entry relies on data from previous entries in the chain. Any unauthorized alterations to any of these entries can be detected. Be aware that data entered into the `content` and `external_ids` fields must be in Base64 format. Sending this request will cause Connect to create the first entry of the chain. The data entered into the `content` and `external_id` fields will be applied to this entry.

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.ChainsApi();
var chainCreate = new HarmonyConnectClient.ChainCreate(); // ChainCreate | 
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.postChain(chainCreate, callback);

Parameters

Name Type Description Notes
chainCreate ChainCreate

Return type

ChainShort

Authorization

AppId, AppKey

HTTP request headers

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

postChainSearch

ChainList postChainSearch(searchBody, opts)

Search Chains

Finds all of the chains with `external_ids` that match what you've entered. External IDs must be sent 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.ChainsApi();
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.postChainSearch(searchBody, opts, callback);

Parameters

Name Type Description Notes
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

ChainList

Authorization

AppId, AppKey

HTTP request headers

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