Introducing SteemData WebAPI

in #steemdata7 years ago

SteemData helps developers and researchers build better STEEM applications. We parse the STEEM blockchain for you, and provide the data as a fast and convenient MongoDB service.

SteemData is a very useful tool, however it does require you to have at least some familiarity with MongoDB. Using MongoDB is fairly easy, but it does add a small barrier to entry for some users.

For example:
What if you don't want to include MongoDB driver as a dependency in your project?
What if all you need is just a simple query to enrich your Steem mobile app?

This is where SteemData WebAPI comes into play.

Features

XML and JSON support

The API will return XML or JSON, based on your request headers.
To get json, simply pass Content-Type: application/json.

Simple Querying

We can query for various simple conditions using a where field. For example,
we could look up an individual user by username like this:

https://webapi.steemdata.com/Accounts?where=name==furion

Alternatively, we can also construct more powerful queries by passing in MongoDB
query objects.

For example, lets find all transfers incoming to a specific account (@furion):

https://webapi.steemdata.com/Operations?where={"type": "transfer", "to": "furion"}

Sorting

We can sort by using a sort field. Prepending field name with - changes order from ascending to descending.

For example, we can find latest transfers with this query:

https://webapi.steemdata.com/Operations?where=type==transfer&sort=-timestamp

HATEOAS for navigation and pagination

HATEOAS is a specification for linking to resources. These links can be followed by the client programatically.

For example, GET https://webapi.steemdata.com/Operations will contain the following links:

{
  "_meta": {
    "page": 1,
    "max_results": 50,
    "total": 34679606
  },
  "_links": {
    "last": {
      "href": "Operations?page=693593",
      "title": "last page"
    },
    "parent": {
      "href": "/",
      "title": "home"
    },
    "next": {
      "href": "Operations?page=2",
      "title": "next page"
    },
    "self": {
      "href": "Operations",
      "title": "Operations"
    }
  },
  "_items": [
    ...
  ]
}

We can simply follow the links for pagination, as well as see how many pages there are.

Additionally, each item will also have a link to itself:

"_items": [
  {
    "_links": {
        "self": {
          "href": "Operations/e35709a49ee67090905a42cebabf8eee9f0de11d",
          "title": "Operation"
        }
      },
    ...
  }
]

Available Endpoints

WebAPI gives you access to all SteemData MongoDB collections.
https://webapi.steemdata.com/Operations
https://webapi.steemdata.com/AccountOperations
https://webapi.steemdata.com/Accounts
https://webapi.steemdata.com/Posts
https://webapi.steemdata.com/PriceHistory

Feel free to play around with this with curl or a GUI tool like Postman.

Need custom functionality for your app?

While WebAPI can work well for most of data fetching related queries, occasionally, a more complex solution is required.

If you need a fast, bandwidth efficient, composite or aggregate query, or custom business logic, feel free to contact me, and I will create you a custom endpoint on Api0.

Api0 is a special API that leverages the power of SteemData and offers custom endpoints for STEEM app developers.

Example Endpoint:
https://api0.steemdata.com/busy.org/furion/with_metadata/followers

Sort:  

A downvote was applied to partially counter earlier whale votes as an experiment to reduce whale domination of voting influence. Not intended to express an opinion on the content nor result in a net reduction of rewards or reputation (automated notice)

Is there an API to vote? if yes, sample please.

Very cool. Great work @furion on all the tools you're building for Steem.

Great work on this furion, nice to see, I hope to dive into it sometime, but havne't had a chance yet!

Glad to see you are looking into Flask(API)!

After a bumpy ride with JavaScript frameworks, I am Flask-everything :)

If you ever want to see some of Streemian.com's or BitShares.eu's backend, just let me know. Both are FLASK heavy

Coin Marketplace

STEEM 0.33
TRX 0.11
JST 0.034
BTC 66598.01
ETH 3236.65
USDT 1.00
SBD 4.66