From a9fc5081653c9fd676a9a0b2884634e4c7a6b4a8 Mon Sep 17 00:00:00 2001 From: Geert Weening Date: Tue, 18 Nov 2014 11:20:10 -0800 Subject: [PATCH 1/2] [DOC] add transaction-fee endpoint --- ripplerest_api.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ripplerest_api.md b/ripplerest_api.md index b1b48601d3..4e25c7bd0d 100644 --- a/ripplerest_api.md +++ b/ripplerest_api.md @@ -40,6 +40,7 @@ Installation instructions and source code can be found in the [Ripple-REST repos #### Utilities #### * [Retrieve Ripple Transaction - `GET /v1/transactions/{:transaction-hash}`](#retrieve-ripple-transaction) +* [Retrieve Transaction Fee - `GET /v1/transaction-fee`](#retrieve-transaction-fee) * [Generate UUID - `GET /v1/uuid`](#create-client-resource-id) @@ -1828,6 +1829,30 @@ The result is a JSON object, whose `transaction` field has the requested transac ``` +## Retrieve Transaction Fee ## + +Retrieve the current transaction fee for the rippled server `ripple-rest` is connected to. If `ripple-rest` is connected to multiple rippled servers, the median fee between the connected servers is calculated. + +
+*REST* + +``` +GET /v1/transaction-fee +``` +
+ +[Try it! >](rest-api-tool.html#retrieve-transaction-fee) + +#### Response #### + +```js +{ + "success": true, + "fee": "12000" +} +``` + + ## Create Client Resource ID ## From f29fad0aa7143dad1f95f280cde5e5e7a22297cc Mon Sep 17 00:00:00 2001 From: Geert Weening Date: Tue, 18 Nov 2014 11:32:06 -0800 Subject: [PATCH 2/2] [DOC] update ripple-rest doc and api tool - add transaction-fee - fix generate wallet - fix /account/{account}/payments - fix /transactions --- js/apitool-rest.js | 52 +++++++++++++++++++++++++++------------------- rest-api-tool.html | 49 ++++++++++++++++++++++--------------------- ripplerest_api.md | 8 ++++--- 3 files changed, 61 insertions(+), 48 deletions(-) diff --git a/js/apitool-rest.js b/js/apitool-rest.js index 1819413d58..287ebd2c24 100644 --- a/js/apitool-rest.js +++ b/js/apitool-rest.js @@ -22,7 +22,7 @@ var DOC_BASE = "ripple-rest.html"; function slugify(str) { str = str.replace(/^\s+|\s+$/g, ''); // trim str = str.toLowerCase(); - + // remove accents, swap ñ for n, etc var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; var to = "aaaaeeeeiiiioooouuuunc------"; @@ -65,11 +65,11 @@ var DEFAULT_ADDRESS_1 = "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"; var DEFAULT_ADDRESS_2 = "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"; var DEFAULT_HASH = "9D591B18EDDD34F0B6CF4223A2940AEA2C3CC778925BABF289E0011CD8FA056E"; -Request('Generate Account', { +Request('Generate Wallet', { method: GET, - path: "/v1/accounts/new", - description: 'Generate the keys for a potential new account', - link: '#generate-account' + path: "/v1/wallet/new", + description: 'Randomly generate keys for a potential new Ripple account', + link: '#generate-wallet' }); Request('Get Account Balances', { @@ -110,7 +110,7 @@ Request('Update Account Settings', { disallow_xrp: false, disable_master: false, email_hash: "98b4375e1d753e5b91627516f6d70977" - } + } } }); @@ -129,7 +129,7 @@ Request('Prepare Payment', { Request('Submit Payment', { method: POST, - path: '/v1/payments', + path: '/v1/accounts/{:source_address}/payments', description: 'Send a prepared payment to the network.', link: '#submit-payment', test_only: true, @@ -157,6 +157,9 @@ Request('Submit Payment', { "partial_payment": false, "no_direct_ripple": false } + }, + params: { + "{:source_address}": DEFAULT_ADDRESS_1 } }); @@ -240,7 +243,7 @@ Request("Get Server Status", { Request("Retrieve Ripple Transaction", { method: GET, - path: "/v1/tx/{:hash}", + path: "/v1/transactions/{:hash}", description: "Retrieve a raw Ripple transaction", link: "#retrieve-ripple-transaction", params: { @@ -248,6 +251,13 @@ Request("Retrieve Ripple Transaction", { } }); +Request("Retrieve Transaction Fee", { + method: GET, + path: "/v1/transaction-fee", + description: "Retrieve the current transaction fee for the connected rippled server(s)", + link: "#retrieve-transaction-fee", +}); + Request("Generate UUID", { method: GET, path: "/v1/uuid", @@ -276,7 +286,7 @@ function update_method(el) { } else { method = $(el).val(); } - + if (method == GET || method == DELETE) { request_body.hide(); } else { @@ -288,10 +298,10 @@ function update_method(el) { function change_path(command) { rest_url.empty(); reminders.html(" "); - + var re = /(\{:[^}]+\})/g; // match stuff like {:address} params = command.path.split(re); - + //console.log(params); for (i=0; i"+default_val+""); - + var new_div = $("
").appendTo(rest_url); var new_param = $("").appendTo(new_div); new_param.autosizeInput({"space": 0}); //var new_label = $("").appendTo(new_div); - - + + } else { rest_url.append(""+params[i]+""); } @@ -316,7 +326,7 @@ function change_path(command) { function select_request(request) { command = requests[request]; - + if (command.test_only === true) { test_warning.show(); } else { @@ -335,18 +345,18 @@ function select_request(request) { selected_command.html($('') .attr('href', DOC_BASE+command.link) .text(command.name)); - + //rest_url.val(command.path); //rest_url.text(command.path); change_path(command); - + // rest_method.val(command.method); // rest_method.change(); request_button.val(command.method); request_button.text(command.method+" request"); update_method(request_button); - + if (command.method == POST || command.method == PUT) { cm_request.setValue(JSON.stringify(command.body, null, 2)); } else { @@ -354,7 +364,7 @@ function select_request(request) { //This prevents confusion if the user toggles the HTTP method dropdown cm_request.setValue(""); } - + reset_response_area(); }; @@ -403,7 +413,7 @@ function send_request() { url: URL_BASE + path }).done(success_output).fail(error_output).always(reset_sending_status); } - + spinner.show(); } @@ -431,7 +441,7 @@ function reset_response_area() { $(document).ready(function() { request_button.click(send_request); //rest_method.change(update_method); - + get_uuid(function(resp,status,xhr) { requests["submit-payment"].body.client_resource_id = resp.uuid; if (window.location.hash == "#submit-payment") { diff --git a/rest-api-tool.html b/rest-api-tool.html index cd6e77bab7..ff228f4862 100644 --- a/rest-api-tool.html +++ b/rest-api-tool.html @@ -8,16 +8,16 @@ Ripple Developer Portal: Ripple-REST API Tool - - + + - + - + @@ -27,20 +27,20 @@ - + - - - + + + - - + + @@ -54,15 +54,15 @@ mixpanel.init("132d42885e094171f34467fc54da6fab"); ga('send', 'pageview'); - - + + + - - + @@ -123,6 +123,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
  • Get Server Status

  • Retrieve Ripple Transaction
  • +
  • Retrieve Transaction Fee
  • Generate UUID
  • @@ -168,7 +169,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");

    - +
    - +

    Join the mailing list!

    @@ -212,11 +213,11 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
    - +
    @@ -227,10 +228,10 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
    - +
    - + diff --git a/ripplerest_api.md b/ripplerest_api.md index 4e25c7bd0d..49451e8b86 100644 --- a/ripplerest_api.md +++ b/ripplerest_api.md @@ -175,7 +175,7 @@ When errors occur, the server returns an HTTP status code in the 400-599 range, In general, the HTTP status code is indicative of where the problem occurred: -* Codes in the 200-299 range indicate success. (*Note:* This behavior is new in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/v1.3.0-rc4). Previous versions sometimes return 200 OK for some types of errors.) +* Codes in the 200-299 range indicate success. (*Note:* This behavior is new in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/1.3.0). Previous versions sometimes return 200 OK for some types of errors.) * Unless otherwise specified, methods are expected to return `200 OK` on success. * Codes in the 400-499 range indicate that the request was invalid or incorrect somehow. For example: * `400 Bad Request` occurs if the JSON body is malformed. This includes syntax errors as well as when invalid or mutually-exclusive options are selected. @@ -331,7 +331,7 @@ Submitted transactions can have additional fields reflecting the current status ### Memo Objects ### -(New in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/v1.3.0-rc4)) +(New in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/1.3.0)) Memo objects represent arbitrary data that can be included in a transaction. The overall size of the `memos` field cannot exceed 1KB after serialization. @@ -391,7 +391,7 @@ Accounts are the core unit of authentication in the Ripple Network. Each account ## Generate Wallet ## -(New in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/v1.3.0-rc4)) +(New in [Ripple-REST v1.3.0](https://github.com/ripple/ripple-rest/releases/tag/1.3.0)) Randomly generate keys for a potential new Ripple account. @@ -1831,6 +1831,8 @@ The result is a JSON object, whose `transaction` field has the requested transac ## Retrieve Transaction Fee ## +(New in [Ripple-REST v1.3.1](https://github.com/ripple/ripple-rest/releases/tag/1.3.1-rc1)) + Retrieve the current transaction fee for the rippled server `ripple-rest` is connected to. If `ripple-rest` is connected to multiple rippled servers, the median fee between the connected servers is calculated.