📈
Everipedia
  • Home
  • Everipedia API
    • Everipedia.org REST API
  • Everipedia OraQles
    • About
    • Data Partners
      • Associated Press
  • Current OraQles Projects
    • January 5th, 2021 Senate Runoff
      • Ethers.js tutorial
      • Solidity Tutorial
  • Past OraQles Projects
    • 2020 US Presidential Election
      • 2020 US Presidential Election - Ethereum
        • Fetch election calls with Solidity
        • Fetch election calls with web3
        • Mainnet Oracle Data
        • Kovan Testnet Oracle Data
      • 2020 US Presidential Election - EOS
Powered by GitBook
On this page

Was this helpful?

  1. Past OraQles Projects
  2. 2020 US Presidential Election

2020 US Presidential Election - EOS

If you want to connect to the full AP Election results in any language over HTTP, learn how here.

PreviousKovan Testnet Oracle Data

Last updated 4 years ago

Was this helpful?

Note that the EOS race calls contain more than just the presidential results. This smart contract contains presidential, house, senate, and governor race calls.

Walkthrough

  1. Fetching EOS Oracle data is a simple HTTP request. Use fetch or your favorite library to make the request

    // in JavaScript
    const allWinners = await fetch('https://eos.hyperion.eosrio.io/v2/history/get_actions?limit=1&account=associapress&filter=associapress%3Aelection&sort=desc')
        .then((res) => res.json())
        .then((res) => {
            return res?.actions?.[0]?.act?.data?.data;
        })
        .then((res) => JSON.parse(res));

2. View the raw JSON response here to ensure you're accessing the data you're interested in:

3. Still having issues?‌

  1. ​Ensure you're accessing the exact part of the JSON object you're interested in. If you want to use the data field as JSON, you have to stringify it first (the code example in #1 above already does this properly)

Tweet to and any engineering questions (or send a DM on Twitter to )

@dawsonbotsford
@everipedia
@dawsonbotsford
https://eos.hyperion.eosrio.io/v2/history/get_actions?limit=1&account=associapress&filter=associapress%3Aelection&sort=desceos.hyperion.eosrio.io
JSON Response from EOS table