API steemit/account 简单封装了一下 steemit/account 的 API

in #cn7 years ago (edited)

I have simply wrapped the code from 第一次使用STEEMSQL查询谷哥点名数据

onto four servers, located at East USA, West USA, Tokyo Japan and London, UK.

This simplifies the API call if you want to retrieve account information, for example, using PHP, you can retrieve that with just two lines of code.

$account = json_decode(file_get_contents("https://uploadbeta.com/api/steemit/account/?id=justyy"), true);

echo $account[0]['voting_power']; // e.g. returns 9002

Cloudflare CDN Edge servers are also available if you invoke the API endpoint via GET method and provides a ?cached parameter i.e.

https://uploadbeta.com/api/steemit/account/?cached&id=justyy

Thanks @oflyhigh  !

前几天看了O哥的大作  第一次使用STEEMSQL查询谷哥点名数据

觉得PHP如此的强大,不愧为星球上最好的编程语言。几行代码就可以把官方提供的API给用了起来。但是在使用的时候还是得引入一些代码,并且有一些参数对于初学者来说比较难懂。

我今天其实想做一个小功能的,突然就想到,如果只是想根据STEEM ID来得到一些帐户的基本信息,能简单一点是一点。于是在O哥的代码上简单封装了一下API,并且提供4个服务器供世界各地的爱好者使用。

我的四个服务器位于:日本东京,英国伦敦,美国西部还有一个美国东部,我长年(好几年)自己花钱租VPS主机,提供免费的API使用,并且用了付费的  Cloudflare CDN 用于保证服务器的安全和稳定,所以尽可以放心用在你的项目上。

这四个API服务器调用是:

API  steemit/account 的使用方法

怎么用呢?很简单:你可以直接在浏览器里打开 (以GET的方式):

https://uploadbeta.com/api/steemit/account/?id=justyy

返回JSON数据。或者你可以通过POST方式,比如这样:

curl -X POST -d "id=justyy" https://uploadbeta.com/api/steemit/account/

返回:

这里还需要指出的是,如果你想获取速度快(比如上面4个服务器都离你太远了 比如澳洲),而你又不是那么需要实时更新的速度,这时候可以用上CloudFlare 的CDN服务器,只要在调用的时候使用:

https://uploadbeta.com/api/steemit/account/?cached&id=justyy

这样调用 API的结果会1小时更新1次,结果缓存于CloudFlare CDN的Edge结点。

弄了这么多,你在PHP里只需要这样两行就可以了:

$account = json_decode(file_get_contents("https://uploadbeta.com/api/steemit/account/?id=justyy"), true);

echo $account[0]['voting_power']; // 获取能量 如 9002

再次感谢 @oflyhigh  我这是站在巨人的肩膀上!

 Originally published at https://steemit.com Thank you for reading my post, feel free to FOLLOW and Upvote @justyy which motivates me to create more quality posts.

原创首发于 https://steemit.com 非常感谢阅读, 欢迎FOLLOW和Upvote @justyy  能激励我创作更多更好的内容.   

 // 稍候同步到我的中文博客英文博客。  

 近期热贴 Recent Popular Posts 

Sort:  

看起来好牛,你怎么还不睡。哈哈

英国时间晚上不到10点

好吧,看来我算你的时间有点问题。哈哈

看得我好晕啊。。我就连上数据库直接select然后循环,输出。。。我就会最简单的。。。

Congratulations @justyy! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published a post every day of the week

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Coin Marketplace

STEEM 0.18
TRX 0.14
JST 0.030
BTC 58613.96
ETH 3153.58
USDT 1.00
SBD 2.43