# 2020 US Presidential Election - EOS

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:<br>

{% embed url="<https://eos.hyperion.eosrio.io/v2/history/get_actions?limit=1&account=associapress&filter=associapress%3Aelection&sort=desc>" %}

![JSON Response from EOS table](https://4237340628-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MKpcvqHmxdH4lqjGSp7%2F-MLEfMINLwWncDp7rLdv%2F-MLEg3kMYJ-P2HkvGfbz%2Fimage.png?alt=media\&token=e8281b2e-25a2-488e-88b9-42bc6300224d)

\
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)
2. Tweet to [@dawsonbotsford](https://twitter.com/dawsonbotsford) and [@everipedia](https://twitter.com/Everipedia) any engineering questions (or send a DM on Twitter to [@dawsonbotsford](https://twitter.com/dawsonbotsford))
