I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

JSON API Documentation and Best Practices?

dashed-slug.net Forums General discussion JSON API Documentation and Best Practices?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #5068

    Hi, I really like your plugins, they are great, thank you!
    Unfortunately I ran into problems using the JSON API documentation hosted on https://www.dashed-slug.net/bitcoin-altcoin-wallets-wordpress-plugin/json-api/

    Is there a more recent, more complete documentation of the JSON API somewhere else?
    Is there a guide about best practices or a simple Getting Started tutorial for interfacing with the JSON API?
    What API version is the linked documentation referring to, and what’s the API’s base URL supposed to be?

    Via trial and error, I’ve found out the following:
    When I’m logged in as a user, the browser sends ajax requests like this:

    I was able to login to wordpress via curl, as you nicely described on page 48 of wallets-3.8.0-manua.pdf (which is included in the most recent download bundle). After that I was able to retrieve transactions like this via cURL:
    curl -b cookie.txt -c cookie.txt 'http://localhost:8000/?__wallets_apiversion=3&__wallets_action=get_transactions&__wallets_tx_count=10&__wallets_tx_from=0&__wallets_symbol=BTC'

    On the same page, the manual states that this API call should work:
    curl -b cookie.txt -c cookie.txt 'http://localhost:8000/wallets/api2/get_coins_info'
    But unfortunately this leads to a “not found” error message.

    However, I found out that I can get a successful response like this:
    curl -b cookie.txt -c cookie.txt 'http://localhost:8000/?__wallets_apiversion=3&__wallets_action=get_coins_info'

    Is the above the best practice pattern for requests?
    How do you authenticate programmatically, e.g. have a script move coins from one user’s wallet to another user’s wallet?

    (P.S.: Changing the “Enable legacy JSON APIs” flag under Wallets>Frontend Settings does not seem to have any effect on this)



    It is true that you need to pass the apiversion argument in all JSON API calls. I must update the documentation to that effect.

    You can initiate an internal (move) transaction via the API. Authentication is basically the login that you did via curl. However, if the plugin requires that transactions are confirmed (by the user or the admin) you cannot override this when entering transactions via the JSON API. ( In contrast, you can override the need for confirmation if you enter transactions via the PHP API, using the skip_confirm argument.

    If you check the “Enable legacy JSON APIs” option, that allows you to pass older apiversion arguments, but you cannot omit it altogether.

    Hope this helps. Please let me know if I did not answer your question fully, or if you have any further questions.

    with regards

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.