mirror of
https://github.com/danbulant/api_docs
synced 2026-05-24 12:27:29 +00:00
Merge pull request #511 from Jameskmonger/patch-1
Add JavaScript examples
This commit is contained in:
commit
ed6578ca73
1 changed files with 21 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ language_tabs:
|
||||||
- shell
|
- shell
|
||||||
- ruby
|
- ruby
|
||||||
- python
|
- python
|
||||||
|
- javascript
|
||||||
|
|
||||||
toc_footers:
|
toc_footers:
|
||||||
- <a href='#'>Sign Up for a Developer Key</a>
|
- <a href='#'>Sign Up for a Developer Key</a>
|
||||||
|
|
@ -46,6 +47,12 @@ curl "api_endpoint_here"
|
||||||
-H "Authorization: meowmeowmeow"
|
-H "Authorization: meowmeowmeow"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const kittn = require('kittn');
|
||||||
|
|
||||||
|
let api = kittn.authorize('meowmeowmeow');
|
||||||
|
```
|
||||||
|
|
||||||
> Make sure to replace `meowmeowmeow` with your API key.
|
> Make sure to replace `meowmeowmeow` with your API key.
|
||||||
|
|
||||||
Kittn uses API keys to allow access to the API. You can register a new Kittn API key at our [developer portal](http://example.com/developers).
|
Kittn uses API keys to allow access to the API. You can register a new Kittn API key at our [developer portal](http://example.com/developers).
|
||||||
|
|
@ -81,6 +88,13 @@ curl "http://example.com/api/kittens"
|
||||||
-H "Authorization: meowmeowmeow"
|
-H "Authorization: meowmeowmeow"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const kittn = require('kittn');
|
||||||
|
|
||||||
|
let api = kittn.authorize('meowmeowmeow');
|
||||||
|
let kittens = api.kittens.get();
|
||||||
|
```
|
||||||
|
|
||||||
> The above command returns JSON structured like this:
|
> The above command returns JSON structured like this:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
@ -140,6 +154,13 @@ curl "http://example.com/api/kittens/2"
|
||||||
-H "Authorization: meowmeowmeow"
|
-H "Authorization: meowmeowmeow"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const kittn = require('kittn');
|
||||||
|
|
||||||
|
let api = kittn.authorize('meowmeowmeow');
|
||||||
|
let max = api.kittens.get(2);
|
||||||
|
```
|
||||||
|
|
||||||
> The above command returns JSON structured like this:
|
> The above command returns JSON structured like this:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue