-
-
Save aviramvijh/b4d12bba074f2ff8e923 to your computer and use it in GitHub Desktop.
A Gist of my markdown file that causes formatting errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: API Reference | |
language_tabs: | |
- shell | |
- ruby | |
- python | |
toc_footers: | |
- <a href='#'>Sign Up for a Developer Key</a> | |
- <a href='http://github.com/tripit/slate'>Documentation Powered by Slate</a> | |
search: true | |
--- | |
# Introduction | |
Welcome to the Kittn API! You can use our API to access Kittn API endpoints, which can get information on various cats, kittens, and breeds in our database. | |
We have language bindings in Shell, Ruby, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. | |
# Authentication | |
> To authorize, use this code: | |
```ruby | |
require 'kittn' | |
api = Kittn::APIClient.authorize!('meowmeowmeow') | |
``` | |
```python | |
import kittn | |
api = kittn.authorize('meowmeowmeow') | |
``` | |
```shell | |
# With shell, you can just pass the correct header with each request | |
curl "api_endpoint_here" | |
-H "Authorization: meowmeowmeow" | |
``` | |
> 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 expects for the API key to be included in all API requests to the server in a header that looks like the following: | |
`Authorization: meowmeowmeow` | |
<aside class="notice"> | |
You must replace `meowmeowmeow` with your personal API key. | |
</aside> | |
# Errors | |
<aside class="notice">This error section is stored in a separate file in `includes/_errors.md`. Slate allows you to optionally separate out your docs into many files...just save them to the `includes` folder and add them to the top of your `index.md`'s frontmatter. Files are included in the order listed.</aside> | |
The King API uses the following error codes: | |
Error Code | Meaning | |
---------- | ------- | |
400 | Bad Request -- Your request sucks | |
401 | Unauthorized -- Your API key is wrong | |
403 | Forbidden -- The kitten requested is hidden for administrators only | |
404 | Not Found -- The specified kitten could not be found | |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method | |
406 | Not Acceptable -- You requested a format that isn't json | |
410 | Gone -- The kitten requested has been removed from our servers | |
418 | I'm a teapot | |
429 | Too Many Requests -- You're requesting too many kittens! Slown down! | |
500 | Internal Server Error -- We had a problem with our server. Try again later. | |
503 | Service Unavailable -- We're temporarially offline for maintanance. Please try again later. | |
# Users | |
## Create a new user | |
```ruby | |
require 'kittn' | |
api = Kittn::APIClient.authorize!('meowmeowmeow') | |
api.kittens.get | |
``` | |
```python | |
import kittn | |
api = kittn.authorize('meowmeowmeow') | |
api.kittens.get() | |
``` | |
```shell | |
curl "http://api.avaya.com/v1/tenants/{tenant-id}/users/" | |
-H "Content-Type: application/json" | |
-d '{ | |
"firstname": "Colin", | |
"lastname": "Yip", | |
"email": "cyip@avaya.com", | |
"location": "Auckland", | |
"group": "Group ID", | |
"extension": "100", | |
"secondary-extension": "200" | |
}' | |
``` | |
> The above command returns JSON structured like this: | |
```json | |
[ | |
{ | |
"id": 1, | |
"name": "Fluffums", | |
"breed": "calico", | |
"fluffiness": 6, | |
"cuteness": 7 | |
}, | |
{ | |
"id": 2, | |
"name": "Isis", | |
"breed": "unknown", | |
"fluffiness": 5, | |
"cuteness": 10 | |
} | |
] | |
``` | |
This endpoint creates a new user. | |
### HTTP Request | |
`POST /tenants/{tenant-id}/users` | |
### Body Parameters | |
Parameter | Required |Type| Description | |
--------- | -------- |----| ----------- | |
firstname | true |String |The first name of the user. | |
lastname | true |String |The last name of the user. | |
email | true |String | The email address of the user. | |
location | false |String | The location of the user. | |
group | true | String |The group to which the user belongs. | |
extension | true | String |The extension of the user. | |
secondary-extension | false | String |The secondary extension of the user. | |
<aside class="success"> | |
Remember — a happy kitten is an authenticated kitten! | |
</aside> | |
## Update a user | |
```ruby | |
require 'kittn' | |
api = Kittn::APIClient.authorize!('meowmeowmeow') | |
api.kittens.get(2) | |
``` | |
```python | |
import kittn | |
api = kittn.authorize('meowmeowmeow') | |
api.kittens.get(2) | |
``` | |
```shell | |
curl "http://api.avaya.com/v1/tenants/{tenant-id}/users/" | |
-H "Content-Type: application/json" | |
-d '{ | |
"firstname": "Colin", | |
"lastname": "Yip", | |
"email": "cyip@avaya.com", | |
"location": "Auckland", | |
"group": "Group ID", | |
"extension": "100", | |
"secondary-extension": "200" | |
}' | |
``` | |
> The above command returns JSON structured like this: | |
```json | |
{ | |
"id": 2, | |
"name": "Isis", | |
"breed": "unknown", | |
"fluffiness": 5, | |
"cuteness": 10 | |
} | |
``` | |
This endpoint updates a specific user. | |
<aside class="warning">If you're not using an administrator API key, note that some kittens will return 403 Forbidden if they are hidden for admins only.</aside> | |
### HTTP Request | |
`PUT /tenants/{tenant-id}/users/{id}` | |
### Path Parameters | |
Parameter | Required |Type| Description | |
--------- | -------- |----| ----------- | |
tenant-id | true |String |Your tenant ID. | |
id | true |String |The user ID. | |
### Body Parameters | |
Parameter | Required |Type| Description | |
--------- | -------- |----| ----------- | |
firstname | true |String |The first name of the user. | |
lastname | true |String |The last name of the user. | |
email | true |String | The email address of the user. | |
location | false |String | The location of the user. | |
group | true | String |The group to which the user belongs. | |
extension | true | String |The extension of the user. | |
secondary-extension | false | String |The secondary extension of the user. | |
## Delete a user | |
```ruby | |
require 'kittn' | |
api = Kittn::APIClient.authorize!('meowmeowmeow') | |
api.kittens.get(2) | |
``` | |
```python | |
import kittn | |
api = kittn.authorize('meowmeowmeow') | |
api.kittens.get(2) | |
``` | |
```shell | |
curl "http://api.avaya.com/v1/tenants/{tenant-id}/users/" | |
-H "Content-Type: application/json" | |
-d '{ | |
"firstname": "Colin", | |
"lastname": "Yip", | |
"email": "cyip@avaya.com", | |
"location": "Auckland", | |
"group": "Group ID", | |
"extension": "100", | |
"secondary-extension": "200" | |
}' | |
``` | |
> The above command returns JSON structured like this: | |
```json | |
{ | |
"id": 2, | |
"name": "Isis", | |
"breed": "unknown", | |
"fluffiness": 5, | |
"cuteness": 10 | |
} | |
``` | |
This endpoint updates a specific user. | |
<aside class="warning">If you're not using an administrator API key, note that some kittens will return 403 Forbidden if they are hidden for admins only.</aside> | |
### HTTP Request | |
`PUT /tenants/{tenant-id}/users/{id}` | |
### Path Parameters | |
Parameter | Required |Type| Description | |
--------- | -------- |----| ----------- | |
tenant-id | true |String |Your tenant ID. | |
id | true |String |The user ID. | |
### Body Parameters | |
Parameter | Required |Type| Description | |
--------- | -------- |----| ----------- | |
firstname | true |String |The first name of the user. | |
lastname | true |String |The last name of the user. | |
email | true |String | The email address of the user. | |
location | false |String | The location of the user. | |
group | true | String |The group to which the user belongs. | |
extension | true | String |The extension of the user. | |
secondary-extension | false | String |The secondary extension of the user. | |
#Presence | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment