.subsection#api-keys
%h3
4.5
%strong API Keys
%h4
4.5.1
%strong Obtaining an API key
:markdown
You can #{link_to "register for an API key", publish_my_data_enterprise.new_user_registration_path} to obtain unthrottled access to our API, analytics, and announcements about upcoming API changes. Upon registering you will be logged in and taken to your profile page which displays your unique key. You should then use the API key with all requests to our API.
%h4
4.5.2
%strong Using the API Key
%p To use the API key, supply it in your requests to our API (including for SPARQL queries) via either:
%ul
%li the X-PublishMyData-APIKey
HTTP header, or
%li the api_key
query string parameter
%br
:markdown
Note that some corporate or goverment networks may strip non-standard HTTP headers, so in these situations we recommend using the query string parameter instead.
%h4
4.5.3
%strong Supplying the API Key in an HTTP header
:markdown
For example, using the cURL command line tool to supply the API key in an HTTP header.
%code.prettyprint
= preserve do
:escaped
curl -H "X-PublishMyData-APIKey: "
:markdown
Replace <your-api-key-here> with your actual API key. e.g.
%code.prettyprint
= preserve do
:escaped
curl -H "X-PublishMyData-APIKey: 1a3e2562d2466ecb9462ddfd723a4597" http://opendatacommunities.org/data/additional-affordable-dwellings.json
%h4
4.5.4
%string Supplying the API key in a query string parameter
:markdown
For example, using the cURL command line tool to supply the API key in the custom HTTP header.
%code.prettyprint
= preserve do
:escaped
curl http://opendatacommunities.org/data/affordable-housing?api_key=
:markdown
Replace <your-api-key-here> with your actual API key. For example:
%code.prettyprint
= preserve do
:escaped
curl http://opendatacommunities.org/data/additional-affordable-dwellings.json?api_key=1a3e2562d2466ecb9462ddfd723a4597