[MERGE] REST docs & tool following pull request #94, including more fixes

This commit is contained in:
mDuo13
2014-11-19 12:32:43 -08:00
3 changed files with 83 additions and 45 deletions

View File

@@ -40,6 +40,7 @@ Installation instructions and source code can be found in the [Ripple-REST repos
#### Utilities ####
* [Retrieve Ripple Transaction - `GET /v1/transactions/{:id}`](#retrieve-ripple-transaction)
* [Retrieve Transaction Fee - `GET /v1/transaction-fee`](#retrieve-transaction-fee)
* [Generate UUID - `GET /v1/uuid`](#create-client-resource-id)
@@ -188,7 +189,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.
@@ -344,7 +345,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.
@@ -404,7 +405,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.
@@ -1842,6 +1843,32 @@ 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.
<div class='multicode'>
*REST*
```
GET /v1/transaction-fee
```
</div>
[Try it! >](rest-api-tool.html#retrieve-transaction-fee)
#### Response ####
```js
{
"success": true,
"fee": "12000"
}
```
## Create Client Resource ID ##

View File

@@ -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------";
@@ -68,7 +68,7 @@ var DEFAULT_HASH = "9D591B18EDDD34F0B6CF4223A2940AEA2C3CC778925BABF289E0011CD8FA
Request('Generate Wallet', {
method: GET,
path: "/v1/wallet/new",
description: 'Generate the keys for a potential new account',
description: 'Randomly generate keys for a potential new Ripple account',
link: '#generate-wallet'
});
@@ -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/transactions/{:hash}",
path: "/v1/transactions/{:id}",
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("&nbsp;");
var re = /(\{:[^}]+\})/g; // match stuff like {:address}
params = command.path.split(re);
//console.log(params);
for (i=0; i<params.length; i++) {
if (params[i].match(/\{:[^}]+\}/) !== null) {
@@ -301,13 +311,13 @@ function change_path(command) {
var default_val = command.params[params[i]];
}
//rest_url.append("<span class='editable' contenteditable='true' id='resturl_"+params[i]+"'>"+default_val+"</span>");
var new_div = $("<div>").appendTo(rest_url);
var new_param = $("<input type='text' id='resturl_"+params[i]+"' value='"+default_val+"' class='editable' title='"+params[i]+"' />").appendTo(new_div);
new_param.autosizeInput({"space": 0});
//var new_label = $("<label class='reminder' for='resturl_"+params[i]+"'>"+params[i]+"</label>").appendTo(new_div);
} else {
rest_url.append("<span class='non_editable'>"+params[i]+"</span>");
}
@@ -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($('<a>')
.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") {

View File

@@ -8,14 +8,14 @@
<title>Ripple Developer Portal: Ripple-REST API Tool</title>
<!-- favicon -->
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<!-- Flatdoc -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
@@ -25,20 +25,20 @@
<link href='https://fonts.googleapis.com/css?family=Open+Sans:600italic,400,700,300' rel='stylesheet' type='text/css'>
<link href='css/main.css' rel='stylesheet'>
<link href='css/custom.css' rel='stylesheet'>
<link rel="shortcut icon" href="favicon.ico?v=2" type="image/x-icon">
<link rel="icon" href="favicon.ico?v=2" type="image/x-icon">
<!-- start Mixpanel -->
<script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
mixpanel.init("132d42885e094171f34467fc54da6fab");
</script>
<script>if (window.location.host == "dev.ripple.com") { mixpanel.track("rest-api-tool"); }</script>
<script>if (window.location.host == "dev.ripple.com") { mixpanel.track("rest-api-tool"); }</script>
<!-- end Mixpanel -->
<!-- start google analytics -->
@@ -52,15 +52,15 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
ga('send', 'pageview');
</script>
<!-- end google analytics -->
<!-- end google analytics -->
<!-- Temporary shims until I modify the css directly -->
<link type='text/css' rel='stylesheet' href='css/mod.css' />
<script src='js/expandcode.js'></script>
</head>
<body>
<!--Draft warning would go here-->
@@ -129,6 +129,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
<li>Get Server Status</li>
<br/>
<li>Retrieve Ripple Transaction</li>
<li>Retrieve Transaction Fee</li>
<li>Generate UUID</li>
</ul>
<div id='command_table'>
@@ -174,7 +175,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
<p class="text-muted">
<div class="row">
<div class="col-md-2">
<ul class="footer_links applications">
<li><a href="https://www.rippletrade.com">Ripple Trade</a>
<li><a href="https://www.ripplecharts.com">Ripple Charts</a>
@@ -183,22 +184,22 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
</ul>
</div>
<div class="col-md-2">
<ul class="footer_links middleware">
<li><a href="gatewayd.html">Gatewayd</a>
<li><a href="ripple-rest.html">Ripple REST</a>
<li><a href="https://github.com/ripple/ripple-lib">Ripple Lib</a>
</ul>
</div>
<div class="col-md-2">
<ul class="footer_links core_network">
<li><a href="rippled-apis.html">rippled</a>
<li><a href="transactions.html">Transactions</a>
<li><a href="consensus-whitepaper.html">Consensus</a>
</ul>
</div>
<div class="col-md-2">
<ul class="footer_links bounties">
@@ -209,7 +210,7 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
<li><a href="https://ripple.com/forum/viewforum.php?f=2&sid=c016bc6b934120b7117c0e136e74de98">Forums</a>
<li><a href="https://ripple.com/wiki/Main_Page">Wiki</a>
</ul>
</div>
<div class="col-md-4 mail_chimp">
<p>Join the mailing list!</p>
@@ -218,11 +219,11 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{clear:left; font:14px; }
</style>
<div id="mc_embed_signup">
<form action="//ripple.us4.list-manage.com/subscribe/post?u=245dbc1c47849f034390dc5bf&amp;id=4dfbe160d0" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px; top: -50px;"><input type="text" name="b_245dbc1c47849f034390dc5bf_4dfbe160d0" tabindex="-1" value=""></div>
@@ -233,10 +234,10 @@ mixpanel.init("132d42885e094171f34467fc54da6fab");
<!--End mc_embed_signup-->
</div>
</div>
</div>
</div>
<link rel='stylesheet' type='text/css' href='css/api-style.css'/>
<link rel='stylesheet' type='text/css' href='css/codemirror.css'/>
<script type='text/javascript' src='js/es5-shim.js'></script>