REST API
The REST API is the interface that you can use to talk to the Credits (CS) blockchain and develop smart contracts.
General Rules
Basic URL
To access the public REST platform Credits you should use basic URL http://apinode.credits.com/api
To access the native REST server, the basic URL specified at the start of the service is used. For example, if you conduct a deployment according to the instructions in this repository, the basic URL will be http://localhost:8080/api
To specify the request, you need to add a specific route to the base URL. Specific routes are indicated for each REST API method in "Summary" paragraph, full URLs are given there as an example of public REST.
Request
Each request includes parameters, structured as a JSON data object, that follows the standard REST API rules.
In addition to those parameters, specific parameters are usually used depending on a particular request. These parameters vary for each request, and are described in the corresponding sections.
Example Request Structure
{
"authKey": "guid",
"networkAlias":"text",
"networkIp": "ip v4 address",
"networkPort": u16_value
}
Parameter Information
guid: authKey: unique identifier(token) of a client, obtained via registration
string: networkAlias: name of the network. there are two possible names at the moment: MainNet and TestNet
string: networkIp: IP address of the requested node
string: networkPort: port open for requests on the node
Parameters networkAlias and the pair networkIp, networkPort are mutually exclusive. It’s recommended to always use the first option, and use the second one only when you need to explicitly indicate the requested node. If both options are specified, networkAlias has a higher priority. Specifying one of the 2 parameters is mandatory.
Example Response
The response includes its own set of elements. However, if there’s an error during request execution, the response always has the following structure:
{
// Error indicator
“Success”: false,
// Error description
“Message”: “text”
}