android package - R.attr nested class -- employing an api key
<p>I trying to imitate a CURL request using the HTTR package in R. It's for propbulica's election API. </p>

<p>propublica.github.io/campaign-finance-api-docs/</p>

<p>The command line request is documented as follows: </p>

<pre><code>curl "https://api.propublica.org/campaign-finance/v1/2016/president/totals.json" -H "X-API-Key: PROPUBLICA_API_KEY"
</code></pre>

<p>My imitation of this in using R is as follows: </p>

<pre><code>require(httr)
api_key &lt;- "my key"
path &lt;- "https://api.propublica.org/campaign-finance/v1/2016/president/totals.json"
data &lt;- GET(path, add_headers("X-API-Key", .headers = api_key))
content(data)
</code></pre>

<p>This returns a "forbidden". </p>

<p>Derek Willis, at ProPublica tells me my key is valid. </p>