addBlock
Attempt to add a new block to the blockchain
/blockchain/addblock
Usage and SDK Samples
curl -X POST\
-H "Accept: application/json"\
-H "Content-Type: application/json"\
"//blockchain/addblock"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DefaultApi;
import java.io.File;
import java.util.*;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
BlockModel body = ; // BlockModel | Block to be added
try {
Object result = apiInstance.addBlock(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#addBlock");
e.printStackTrace();
}
}
}
import io.swagger.client.api.DefaultApi;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
BlockModel body = ; // BlockModel | Block to be added
try {
Object result = apiInstance.addBlock(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#addBlock");
e.printStackTrace();
}
}
}
BlockModel *body = ; // Block to be added
DefaultApi *apiInstance = [[DefaultApi alloc] init];
// Attempt to add a new block to the blockchain
[apiInstance addBlockWith:body
completionHandler: ^(Object output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var JrcNodeServerApiSpec = require('jrc_node_server_api_spec');
var api = new JrcNodeServerApiSpec.DefaultApi()
var body = ; // {{BlockModel}} Block to be added
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.addBlock(body, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class addBlockExample
{
public void main()
{
var apiInstance = new DefaultApi();
var body = new BlockModel(); // BlockModel | Block to be added
try
{
// Attempt to add a new block to the blockchain
Object result = apiInstance.addBlock(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.addBlock: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\ApiDefaultApi();
$body = ; // BlockModel | Block to be added
try {
$result = $api_instance->addBlock($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->addBlock: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DefaultApi;
my $api_instance = WWW::SwaggerClient::DefaultApi->new();
my $body = WWW::SwaggerClient::Object::BlockModel->new(); # BlockModel | Block to be added
eval {
my $result = $api_instance->addBlock(body => $body);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DefaultApi->addBlock: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
body = # BlockModel | Block to be added
try:
# Attempt to add a new block to the blockchain
api_response = api_instance.add_block(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->addBlock: %s\n" % e)
Parameters
Body parameters
Name | Description |
---|---|
body * |