forked from nuls-io/devsite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs/Docs/i_rpc_protocol.md: clarified URL services, and obsolete (ve…
…rsion 1) details docs/Docs/i_public_service.md: editing
- Loading branch information
1 parent
d1c1aa4
commit 55ff4d7
Showing
2 changed files
with
13 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |