Quick Start - Guide for Developers¶
How to get all links connected with Ethereum¶
The code snippets will return a list of news shared to Ethereum context sorted according to our simple algorithm.
Demo:
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 messages from ERC721 token (such as CryptoKitty Captain Barbosa)¶
Demo:
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¶
How to get all CryptoBots owned by given address
cURL¶
$ curl 'https://api.userfeeds.io/ranking/tokens;identity=0x6be450972b30891b16c8588dcbc10c8c2aef04da;asset=ethereum:0xf7a6e15dfd5cdd9ef12711bd757a9b6021abf643'
{"items":[{"sequence":5289388,"token":"4085"}]}