Create documentation on how to query API
tpmccallum opened this issue · 2 comments
tpmccallum commented
Users can visit the search engine and search using words and addresses. In addition to this machines can also query the search engine programmatically.
For example
Curl
Using curl in the command line
curl -X GET "http://54.252.157.165/api/data1" -H 'Content-Type: application/json' -d' {"query": {"match": {"contractAddress": "0x0fEB15a0F7029b0F4aF355aa2Fc3CFa6Df7C8483"}}}'
Javascript
_data = {
"query": {
"match_all": {}
}
}
var _dataString = JSON.stringify(_data);
$.ajax({
url: "http://54.252.157.165/api/data2",
type: "POST",
data: _dataString,
dataType: "json",
contentType: "application/json",
success: function(response) {
console.log(response);
},
error: function(xhr) {
console.log("Get items failed");
}
});
For example the Javascript code above will return the following
tpmccallum commented
I have made a start on this by creating a usage page
https://github.com/second-state/smart-contract-search-engine/blob/master/documentation/usage.md
tpmccallum commented
This page now has examples and links to resources which will facilitate all querying.
https://github.com/second-state/smart-contract-search-engine/blob/master/documentation/usage.md