Skip to content

Commit f998b97

Browse files
committed
API keys are no longer needed
1 parent f2c7ab1 commit f998b97

File tree

3 files changed

+2567
-1141
lines changed

3 files changed

+2567
-1141
lines changed

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ and then:
2323

2424
```js
2525
var w3capi = require('node-w3capi');
26-
w3capi.apiKey = 'deadb33f'; // Your API key.
2726
```
2827

2928
### Client-side
@@ -32,31 +31,15 @@ Grab the AMD module ([`lib/w3capi.js`](https://w3c.github.io/node-w3capi/lib/w3c
3231

3332
```js
3433
requirejs(['w3capi'], function(w3capi) {
35-
w3capi.apiKey = 'deadb33f'; // Your API key.
36-
w3capi.authMode = 'param';
3734
});
3835
```
3936

40-
## :warning: Important
41-
42-
the API is only available if you have an API key.
43-
In order to obtain one, [you need to apply through your W3C account page](https://w3c.github.io/w3c-api/#apikeys).
44-
45-
If you wish to run the tests, you need to set an environment variable named `W3CAPIKEY` to that value, as in
46-
47-
```bash
48-
W3CAPIKEY=deadb33f npm test
49-
```
50-
5137
## API
5238

5339
This documentation does not describe the fields that the various objects have; refer to the [W3C API's documentation](https://api.w3.org/doc) for that.
5440

5541
Everything always starts in the same way:
5642

57-
You *will* need an API key. Nothing will work without it. ***NOTE***: this library does not support
58-
keys that were created with a list of origins. You should generate a key with no list of domains.
59-
6043
This gives you a client instance that's immediately ready to work. You then chain some methods to
6144
specify what you want to get, and fetch with a callback. For example:
6245

lib/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ var sua = require("superagent")
66
// this is the base URL we use, which can be overridden
77
exports.baseURL = "https://api.w3.org/";
88

9-
// this is the API key, you have to set it
10-
exports.apiKey = null;
11-
129
// Authorisation mode: 'header' for HTTP header; 'param' for query parameter.
1310
exports.authMode = 'header';
1411

@@ -18,10 +15,6 @@ function makeRequest (url, embed, page) {
1815
, result = sua.get(url);
1916
if (embed) query.embed = "true";
2017
if (page) query.page = page;
21-
if (!exports.apiKey) throw new Error("No API key.");
22-
if ('header' === exports.authMode) result.set('Authorization', 'W3C-API apikey="' + exports.apiKey + '"');
23-
else if ('param' === exports.authMode) query.apikey = exports.apiKey;
24-
else throw new Error("Invalid authorisation mode.");
2518
return result.accept("json")
2619
.query(query)
2720
;

0 commit comments

Comments
 (0)