Skip to content

Commit

Permalink
Update api_restrictions.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cedar-book committed May 23, 2018
1 parent 6da2927 commit 3a9d3ee
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions developers/apis/api_restrictions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Examples
- [Accessing Restricted API's ](/developers/apis/api_restrictions.md#accessing-restricted-apis)
- Example
- [Accessing the Named API via HTTP](/developers/apis/api_restrictions.md#accessing-the-named-api-via-http)
- Example
- [Login In](/developers/apis/api_restrictions.md#login-in)
- *class* graphene::app::login_api

Expand Down Expand Up @@ -89,6 +91,38 @@ Since the `network_node` API requires login, it is only accessible over the webs

***

## Accessing the Named API via HTTP

When you access the API via HTTP, use the name of the APIs like below,

curl --data '{"jsonrpc": "2.0", "params": ["history", "get_account_history", ["1.2.31489", "1.11.0", 10, "1.11.0"]], "method": "call", "id": 10}' http://testgraphene:8090/rpc

If the API is restricted, specify the credentials using standard HTTP Headers,

curl -u bytemaster:supersecret --data '{"jsonrpc": "2.0", "params": ["history", "get_account_history", ["1.2.31489", "1.11.0", 10, "1.11.0"]], "method": "call", "id": 10}' http://testgraphene:8090/rpc

When you use WS, use like below to prevent unnecessary round trips (login, query API number, call function)

wscat -c ws://bytemaster:supersecret@testgraphene:8090


#### Needs the following FC library PRs to work

This comment has been minimized.

Copy link
@abitmore

abitmore May 23, 2018

Member

Thanks for the update.

Those PRs have been merged into master branch long before, so no need to mention it in the final document.


Add access to HTTP request headers in websocket_connection
bitshares/bitshares-fc#1

Replace the call to get_api_by_name
bitshares/bitshares-fc#2

It also preserve:

- Same default api access permissions
- Possibility to use numbers to specify the API
- Default API numbers (database = 0, login = 1)
- Old ws mechanics => connect / login / query api number / call

***

## Login In

The `login_api` class implements the bottom layer of the RPC API. All other APIs must be requested from this API.
Expand Down

0 comments on commit 3a9d3ee

Please sign in to comment.