# Using the Endpoint Examples¶

To make understanding the Blockchain API easier, a number of examples have been provided to illustrate endpoint usage for each of the endpoints with variations for the intended target blockchain implementations1.

Use these examples, in conjunction with the endpoint documentation, to help understand how each endpoint is invoked.

## Description of the Examples¶

Each example shows a typical endpoint call with example data for each supported blockchain.

The panel for each blockchain example has the following tabs:

• cURL

This is an example command line invocation of cURL that makes the call to the endpoint.

• You will need to edit this command to insert your own API key in order to make it work.

• You may also need to alter other data, such as the addresses before the API call will succeed.

• Formatted cURL

A formatted and more readable representation of the cURL invocation.

In most cases it will not be possible to just copy and past this onto the command line to run but should, instead, be regarded as descriptive documentation.

If you wish to edit these, and then copy/paste into the command line, then you will either need to join the lines together into a single line (Vim's :%j command does this well, as does Visual Studio Code's join lines command (Ctrl+Shift P then join lines Enter)) or add continuation characters2 to make a single logical line.

• Response

The body of any response returned from the call.

Usually in the form of a JSON data object, described in greater detail in the endpoint's main documentation page, and the Object Definitions section.

cURL Limitations when POSTing JSON Bodies

It is not generally possible to just copy this output and paste it into a cURL call.

Using a command line tool such as cURL, while quick and effective for experimentation, does have limitations imposed upon it by the command line environment, or shell, that it is invoked from. Most relevant to the use of JSON is that the data should be on a single logical line and that special characters (for example, single quotes, double quotes and backslashes) must be escaped.

Please consult your environment's documentation and How do I (un)escape JSON objects to use with cURL or in program code? for more information on escaping JSON objects.

The header block added to the HTTPS call with the -H options of the cURL invocation and which should be added to your code calling this endpoint.

• POST Body

There is no Post Body tab in GET requests

An un-escaped3 and formatted specimen of the body of the example cURL call for POST type endpoints. In most of the cURL examples, this is the value of the -d command line option.

See the endpoint's main documentation page for more information on its composition.

Remember that if you wish to use this data directly in a cURL command line invocation, you will need to compress and escape3 it in a manner appropriate to your command line environment (shell).

## Transfers Endpoint Examples¶

Some of the following information might also be of use when using the examples:

### Using cURL with the Examples¶

cURL documentation can be found on the cURL Project's website.

Of particular interest is Everything curl which is an extensive, detailed and totally free book, available in multiple formats.

#### cURL Limitations when POSTing JSON Bodies¶

It is not generally possible to just copy this output and paste it into a cURL call.

Using a command line tool such as cURL, while quick and effective for experimentation, does have limitations imposed upon it by the command line environment, or shell, that it is invoked from. Most relevant to the use of JSON is that the data should be on a single logical line2 and that special characters (for example, single quotes, double quotes and backslashes) must be escaped. Please consult your environment's documentation and How do I (un)escape JSON objects to use with cURL or in program code? for more information.

#### Other Information¶

1. The blockchains supported are Bitcoin (BTC) Ethereum (ETH) and DCore (DCT)

2. Meaning that, if the logical line is broken up over several physical lines, then a special line-continuation character, or sequence, will usually be needed at the end of each line except the last. Please consult your shell's documentation for more information. For Bash this character is '\' (backslash) and for a Windows (MSDOS style) command line, it is the '^' character.

3. Some characters on the command line, and in a program, have semantics that are special to the system. Unfortunately there are times where these characters need to be used in strings or other data and it is necessary to suspend their special status. 'Escaping' them, meaning prefixing with another special character, usually a backslash ('\') that informs the system that they should be taken literally and perform no special action.