Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new APIs and fix some issues related to login_api #2617

Merged
merged 11 commits into from
Jul 31, 2022

Conversation

abitmore
Copy link
Member

@abitmore abitmore commented Jul 29, 2022

PR for #626, #2614, #1689.

  • Add login_api::get_available_api_sets API, which returns a list of API sets that the user has access to. For How to know available API in the connected node? #1689. E.G.
    $ curl -d '{"id":1,"method":"call","params":["login","get_available_api_sets",[]]}' http://localhost:8090; echo                
    {"id":1,"result":["database_api","history_api","network_broadcast_api"]}
    
  • Add login_api::get_info API, which returns a string defined by the node operator via a new api-node-info node startup option. For Server Info API #626. E.G.
    $ curl -d '{"id":1,"method":"call","params":["login","get_info",[]]}' http://localhost:8090; echo
    {"id":1,"result":"Hello, this is my API node"}
    
  • Add login_api::get_config API, which returns the configured application options, including API limits and etc. It requires the user to be logged in and have access to at least one API set other than login_api. For Server Info API #626. E.G.
    $ curl -d '{"id":1,"method":"call","params":["login","get_config",[]]}' http://localhost:8090; echo
    {"id":1,"result":{"enable_subscribe_to_all":false,"has_api_helper_indexes_plugin":true,"has_market_history_plugin":true,"api_limit_get_account_history":100,"api_limit_get_account_history_operations":100,"api_limit_get_account_history_by_operations":100,"api_limit_get_relative_account_history":100,"api_limit_get_market_history":200,"api_limit_get_trade_history":100,"api_limit_get_trade_history_by_sequence":100,"api_limit_get_liquidity_pool_history":101,"api_limit_get_top_markets":100,"api_limit_get_assets":101,"api_limit_get_asset_holders":100,"api_limit_get_key_references":100,"api_limit_get_full_accounts":50,"api_limit_get_full_accounts_lists":500,"api_limit_get_full_accounts_subscribe":100,"api_limit_get_top_voters":200,"api_limit_get_limit_orders":300,"api_limit_get_limit_orders_by_account":101,"api_limit_get_account_limit_orders":101,"api_limit_get_grouped_limit_orders":101,"api_limit_get_order_book":50,"api_limit_get_call_orders":300,"api_limit_get_settle_orders":300,"api_limit_get_collateral_bids":100,"api_limit_lookup_accounts":1000,"api_limit_lookup_witness_accounts":1000,"api_limit_lookup_committee_member_accounts":1000,"api_limit_lookup_vote_ids":1000,"api_limit_list_htlcs":100,"api_limit_get_htlc_by":100,"api_limit_get_withdraw_permissions_by_giver":101,"api_limit_get_withdraw_permissions_by_recipient":101,"api_limit_get_tickets":101,"api_limit_get_liquidity_pools":101,"api_limit_get_samet_funds":101,"api_limit_get_credit_offers":101}}
    
  • Add login_api::logout API, which always returns false. E.G.
    $ curl -d '{"id":1,"method":"call","params":["login","logout",[]]}' http://localhost:8090; echo
    {"id":1,"result":false}
    
  • Fix issues listed in Login API issues #2614.
    • Update login_api::login API to accept an empty argument list, in this case it returns the API set ID allocated to the login API set, which is always 1. This is needed to support named API call in the login API set itself.
    • Update docs to clarify that authentication via HTTP Basic authentication is always tried by default, thus calling login_api::login API explicitly is not always required by clients.
    • If authentication via HTTP Basic authentication fails (E.G. due to a wrong password), or the authenticated user does not have access to the database API set, the API set ID 0 will be allocated to a dummy API set. If the authentication succeeds, 0 will be allocated to the database API set, and the login_api::database API will always return 0, even after logged out and re-logged in.
    • Only create API objects when required (except the ID 0).
    • Avoid creating duplicate API objects.

@abitmore abitmore added this to the 6.1.0 - Feature Release milestone Jul 29, 2022
@abitmore abitmore changed the title Add login_api::get_config API and fix some issues related to login_api Add some APIs and fix some issues related to login_api Jul 29, 2022
@abitmore abitmore changed the title Add some APIs and fix some issues related to login_api Add new APIs and fix some issues related to login_api Jul 29, 2022
@abitmore abitmore marked this pull request as ready for review July 29, 2022 18:36
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

87.1% 87.1% Coverage
0.0% 0.0% Duplication

@abitmore abitmore merged commit cc2779c into develop Jul 31, 2022
@abitmore abitmore deleted the pr-2614-login-apis branch July 31, 2022 18:40
@abitmore abitmore mentioned this pull request Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Login API issues How to know available API in the connected node? Server Info API
1 participant