Pulling wallet (and other) profile data from steemit.com/@username.json using javascript by justinw

View this thread on steempeak.com
· @justinw ·
$217.02
Pulling wallet (and other) profile data from steemit.com/@username.json using javascript
![steemnode.png](https://steemitimages.com/DQmNfuy8skgxXnAMNtM8tBjwu8Bo9ffB9bux8fcDE4WeZHg/steemnode.png)

Did you know that steemit.com's front-end (condenser) serves profile data for use in other applications via JSON? Check it out, example: [steemit.com/@username.json](https://steemit.com/@username.json). Just fill in your username and go.

SBD, STEEM, and VESTS balances are available in addition to quite a bit more.

steemit.com serves content in gzip compressed format, so you do need to load a library and pipe it in order to get valid JSON - easy enough.

I'm sure some of you will find this useful :)

This is an example and it just displays a few objects, but it's as simple as this:

```
const https = require('https');
const zlib = require('zlib');

let options = {
	host: 'steemit.com',
	path: '/@username.json'
};
    
https.get(options, function (res) {
	let json = '';
	let gunzip = zlib.createGunzip();
	res.pipe(gunzip);
	gunzip.on('data', function (chunk) {
		json += chunk;
	});
	gunzip.on('end', function () {
		if (res.statusCode === 200) {
			try {
				let data = JSON.parse(json);
				console.log('STEEM balance: ' + data.user.balance);
				console.log('SBD balance: ' + data.user.sbd_balance);
				console.log('VEST balance: ' + data.user.vesting_shares);
			} catch (e) {
				console.log('Error parsing JSON');
			}
		} else {
			console.log('Non-200 status code received: ' + res.statusCode);
		}
	}).on('error', function (err) {
		console.log('Error pulling JSON: ' + err);
	});
});

```

Enjoy and Steem On!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
post_id3,326,127
authorjustinw
permlinkpulling-wallet-and-other-profile-data-from-steemit-com-username-json-using-javascript
categorysteemdev
json_metadata"{"app": "steemit/0.1", "format": "markdown", "links": ["https://steemit.com/@username.json"], "image": ["https://steemitimages.com/DQmNfuy8skgxXnAMNtM8tBjwu8Bo9ffB9bux8fcDE4WeZHg/steemnode.png"], "tags": ["steemdev", "steemit", "steem", "javascript", "nodejs"]}"
created2017-06-03 06:46:00
last_update2017-06-03 06:46:00
depth0
children1
net_rshares13,849,865,820,390
last_payout2017-06-10 06:46:00
cashout_time1969-12-31 23:59:59
total_payout_value172.476 SBD
curator_payout_value44.542 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,539
author_reputation8,275,186,260,175
root_title"Pulling wallet (and other) profile data from steemit.com/@username.json using javascript"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (41)
@rhino ·
$0.13
Cool. Thanks
👍  ,
properties (23)
post_id3,327,836
authorrhino
permlinkre-justinw-pulling-wallet-and-other-profile-data-from-steemit-com-username-json-using-javascript-20170603t081641798z
categorysteemdev
json_metadata"{"app": "steemit/0.1", "tags": ["steemdev"]}"
created2017-06-03 08:16:42
last_update2017-06-03 08:16:42
depth1
children0
net_rshares36,341,439,567
last_payout2017-06-10 08:16:42
cashout_time1969-12-31 23:59:59
total_payout_value0.098 SBD
curator_payout_value0.029 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length12
author_reputation2,958,769,349,525
root_title"Pulling wallet (and other) profile data from steemit.com/@username.json using javascript"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)