Quick Start - Guide for Developers¶
How to get all links connected with Ethereum¶
The code snippets presented below the Demo window return a list of news or messages shared to an Ethereum context and sorted according to our simple algorithms.
The obtained information and rankings shown in the Demo window below are a result of applying the algorithms presented per programming language in sections beneath the Demo.
The algorithm used for getting scores in the Demo is available here
Demo:
In order to get the same type of information as presented in the Demo, copy the URL provided below into your application or browser.
cURL¶
$ curl 'https://api.userfeeds.io/ranking/links;asset=ethereum'
In JavaScript (browser)¶
<!DOCTYPE html>
<html>
<head>
<title>Simple ranking for Ethereum:</title>
</head>
<body>
<script>
fetch('https://api.userfeeds.io/ranking/links;asset=ethereum')
.then(function(response) {
return response.json();
})
.then(function(ranking) {
var div = document.getElementById('ranking');
for (var i = 0; i < ranking.items.length; i++) {
var item = ranking.items[i];
div.innerHTML += i.toString() + '.<a href="' + item.target + '">' + item.target + '</a><br/>';
div.innerHTML += 'Score: ' + item.score + '<br/><br/>';
}
});
</script>
<h1>Simple ranking for Ethereum</h1>
<div id="ranking"></div>
</body>
</html>
In JavaScript (node.js)¶
const https = require('https');
const options = {
hostname: 'api.userfeeds.io',
port: 443,
path: '/ranking/links;asset=ethereum',
method: 'GET'
};
console.log('Simple ranking for Ethereum:\n')
const req = https.request(options, (res) => {
let data = "";
res.setEncoding('utf8');
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
let ranking = JSON.parse(data);
for (let index in ranking.items) {
console.log(`${index}. ${ranking.items[index].target}`);
console.log(`Score: ${ranking.items[index].score}\n`);
}
});
});
req.on('error', (e) => {
console.error(e);
});
req.end();
// Simple ranking for Ethereum:
//
// 0. http://example.com/one
// Score: 123.1234324
//
// 1. http://example.com/two
// Score: 32.234542343
In python¶
import requests
RANKING_URL = "https://api.userfeeds.io/ranking/links;asset=ethereum"
response = requests.get(RANKING_URL).json()
print("Simple ranking for Ethereum:\n")
for index, item in enumerate(response['items']):
print("{0}. {1}".format(index, item["target"]))
print("Score: {0}".format(item['score']))
print()
# Simple ranking for Ethereum:
#
# 0. http://example.com/one
# Score: 123.1234324
#
# 1. http://example.com/two
# Score: 32.234542343
How to get all feeds existing on ERC721 token (such as CryptoKitty Captain Barbosa)¶
Note
It is important to remember that the ERC721 is recognized as one of standards for tokens.
The feed is the message (call) you send and any message (call) sent to you and about you.
The algorithm used for getting information presented in the Demo is available here
Demo:
In order to get all feeds existing on the ERC721 token, copy the URL provided below into your application or browser.
cURL¶
$ curl 'https://api.userfeeds.io/ranking/feed;context=ethereum:0x06012c8cf97bead5deae237070f9587f8e7a266d:134330'
{"items":[{"about":null,"abouted":[],"author":"0x6be450972b30891b16c8588dcbc10c8c2aef04da","context":"ethereum:0x0...
In JavaScript (browser)¶
<!DOCTYPE html>
<html>
<head>
<title>Simple ranking for Ethereum:</title>
</head>
<body>
<script>
fetch('https://api.userfeeds.io/ranking/cryptopurr_feed;context=ethereum:0x06012c8cf97bead5deae237070f9587f8e7a266d:134330')
.then(function(response) {
return response.json();
})
.then(function(ranking) {
var div = document.getElementById('ranking');
for (var i = 0; i < ranking.items.length; i++) {
var item = ranking.items[i];
div.innerHTML += i.toString() + '. ' + item.target.id + '<br/>';
}
});
</script>
<h1>Simple ranking for Ethereum</h1>
<div id="ranking"></div>
</body>
</html>
In JavaScript (node.js)¶
const https = require('https');
const options = {
hostname: 'api.userfeeds.io',
port: 443,
path: '/ranking/cryptopurr_feed;context=ethereum:0x06012c8cf97bead5deae237070f9587f8e7a266d:134330',
method: 'GET'
};
console.log('Simple ranking for Ethereum:\n')
const req = https.request(options, (res) => {
let data = "";
res.setEncoding('utf8');
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
let ranking = JSON.parse(data);
for (let index in ranking.items) {
console.log(`${index}. ${ranking.items[index].target.id}`);
}
});
});
req.on('error', (e) => {
console.error(e);
});
req.end();
// Simple ranking for Ethereum:
//
// 0. http://example.com/one
// Score: 123.1234324
//
// 1. http://example.com/two
// Score: 32.234542343
In python¶
import requests
RANKING_URL = "https://api.userfeeds.io/ranking/cryptopurr_feed;context=ethereum:0x06012c8cf97bead5deae237070f9587f8e7a266d:134330"
response = requests.get(RANKING_URL).json()
print("Simple ranking for Ethereum:\n")
for index, item in enumerate(response['items']):
print("{0}. {1}".format(index, item["target"]["id"]))
print()
How to get all bots (ERC721 tokens) owned by given address¶
Note
It is important to remember that the ERC721 is recognized as one of standards for tokens.
In order to get all CryptoBots owned by a given address, copy the URL provided below into your application or browser.
cURL¶
$ curl 'https://api.userfeeds.io/ranking/tokens;identity=0x6be450972b30891b16c8588dcbc10c8c2aef04da;asset=ethereum:0xf7a6e15dfd5cdd9ef12711bd757a9b6021abf643'
{"items":[{"sequence":5289388,"token":"4085"}]}