Skip to content

Commit

Permalink
docs/Docs/i_rpc_protocol.md: clarified URL services, and obsolete (ve…
Browse files Browse the repository at this point in the history
…rsion 1) details

docs/Docs/i_public_service.md: editing
  • Loading branch information
KathyNorman committed Oct 10, 2019
1 parent d1c1aa4 commit 55ff4d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 74 deletions.
10 changes: 5 additions & 5 deletions docs/Docs/i_public_service.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Introduction

Each NULS 2.0 node can optionally provide a set of API interfaces for obtaining historical blockchain data from nodes. The interface is provided through [JSON-RPC](https://www.jsonrpc.org/specification), and the underlying layer communicates using HTTP protocol.
Historical blockchain data, is data collected from each completed block since the node was started. This interface does not update blockchain data. (nuls-api updates blockchain data.)
Each NULS 2.0 node can optionally provide a set of API interfaces for obtaining blockchain data from nodes. The interface is provided through [JSON-RPC](https://www.jsonrpc.org/specification), and the underlying layer communicates using HTTP protocol.
Blockchain data is data collected from each completed block since the node was started. This interface does not update blockchain data. (nuls-api updates blockchain data.)

For more information about public-service consult the [Public-Service Module Design Document](https://docs.nuls.io/Docs/d_public_service.html#module-overview).
For more information about public-service consult the [Public-Service Module Design Document](https://docs.nuls.io/Docs/d_public_service.html).


## Installation
Expand All @@ -22,7 +22,7 @@ Installation instructions:

2.enter: cd wallet

3.Add public-service
3.Add the public-service module


```
Expand Down Expand Up @@ -54,7 +54,7 @@ rpcPort=18003

9.Ensure that all processes have started: ./check-status

10.After step 9 is complete, the node is running successfully. The node has begun to parse the synchronized blocks and store the collected data in the mongo database. You can confirm that mongo and public-service are working by checking: Logs/public-service/public-service.log.
After the node has successfulluy started, the node will parse the current block and store the collected data in the mongo database. You can confirm that mongo and public-service are working by checking: Logs/public-service/public-service.log.

List the public-service log to confirm that the database daemon mongo is receiving information from public-service. The log will report the connection and display information to confirm that public-service is processing the blocks.

Expand Down
77 changes: 8 additions & 69 deletions docs/Docs/i_rpc_protocol.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,20 @@
# Interface interact
# NULS Application Interface Services

## Public API Service
## API Services

| Domain | Service Specification |
| ----------- | ----- |
| Domain | Service Provided |
| ----------- | ---------------------------- |
| https://api.nuls.io | nuls-api Service |
| https://apiserver.nuls.io | Public Service |
| https://public1.nuls.io | Public Service |
| https://v1.api.nuls.io | 1.0 Public Service |
| https://v1.api.nuls.io | Public Service |

## Interface format

### Request Body

```json
{
"cmd": "nuls_accounts",
"params": ["param1", "param2"],
"min_version": 1.0,
}
```

- Request parameters

| Parameters | Required | Type | Description|
| ----------- | ----- | ------ | -------------- |
| cmd | true | string | Execute Command |
Params | true | array | Command Parameter Table |
| min_version | false | float | compatible minimum version |
For more information about public-service consult the [Public-Service Interface Document](https://docs.nuls.io/Docs/i_public_service.html#introduction) and the [Public-Service Module Design Document](https://docs.nuls.io/Docs/d_public_service.html).

### Response Body

- success

```json
{
"code":0,
"msg": "Success",
"result": {}
}
```

- Response parameters

| Parameters | Required | Type | Description|
| :----- | :--- | :----- | --------------------------------------- |
| code | ture | int | Request the desired state, returning 0 successfully.Otherwise return error code|
| msg | true | string | User-Friendly Request Execution Result Description |
| result | true | object | method return value |

### Error Code

#### JSON RPC Standard errors

| Code | Possible Return message | Description |
| --------- | ----------------------- | ------------------------------------------------------------ |
| 0 | Success | Operation success |
| 1 | Parse error | Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text. |
| 2 | Invalid Request | The JSON sent is not a valid Request object. |
| 3 | Method not found | The method does not exist / is not available. |
| 4 | Invalid params | Invalid method parameter(s). |
| 5 | Internal error | Internal JSON-RPC error. |
| 6 | Unauthorized | Should be used when some action is not authorized, e.g. sending from a locked account. |
| 7 | Action not allowed | Should be used when some action is not allowed, e.g. preventing an action, while another depending action is processing on, like sending again when a confirmation popup is shown to the user (?). |
| 8 | Timeout | Should be used when an action timedout. |
| 9 | Conflict | Should be used when an action conflicts with another (ongoing?) action. |
| 10 | Execution error | Will contain a subset of custom errors in the data field. See below. |
| 11 to 100 | `Server error` | Reserved for implementation-defined server-errors. |

#### Custom error fields

Custom error `10` can contain custom error(s) to further explain what went wrong.

```js
{
code: 10,
msg: 'Execution error',
}
```
For more information about nuls-api consult the [NULS 2.0 SDK-Provider](https://github.com/nuls-io/devsite/blob/master/docs/Docs/sdkProvider.md).

Both interfaces support JSON-RPC and Restful.

0 comments on commit 55ff4d7

Please sign in to comment.