touch-ups, split cook book into separate html, start replacing HTTP Request w/ blockquote style
This commit is contained in:
parent
f1d8f3e561
commit
900e205c68
7 changed files with 85 additions and 140 deletions
|
|
@ -6,6 +6,7 @@ class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
|
|||
super
|
||||
@head_count = {}
|
||||
end
|
||||
|
||||
def header(text, header_level)
|
||||
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
|
||||
if friendly_text.strip.length == 0
|
||||
|
|
|
|||
27
source/cookbook.html.erb
Normal file
27
source/cookbook.html.erb
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
|
||||
title: Adafruit IO API Cookbook
|
||||
|
||||
language_tabs:
|
||||
- shell: CURL
|
||||
- cpp: Arduino
|
||||
- python: Python
|
||||
- python: Circuitpython
|
||||
- ruby: Ruby
|
||||
|
||||
toc_prepend:
|
||||
- href: /
|
||||
text: API Documentation
|
||||
|
||||
toc_footers:
|
||||
- <a href='https://io.adafruit.com'>Adafruit IO</a>
|
||||
- <a href='https://io.adafruit.com/blog'>Adafruit IO News</a>
|
||||
- <a href='https://io.adafruit.com/plus'>Adafruit IO Plus</a>
|
||||
- <a href='https://io.adafruit.com/terms'>Adafruit IO ToS</a>
|
||||
- <a href='https://io.adafruit.com/feedback'>Submit Feedback</a>
|
||||
|
||||
includes:
|
||||
- cookbook.md.erb
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# Client Libraries
|
||||
We have lots of client libraries to help you get started with your project:
|
||||
We have lots of client libraries to help you get started with your project:
|
||||
|
||||
* [Arduino C++](https://github.com/adafruit/Adafruit_IO_Arduino)
|
||||
|
||||
|
|
@ -9,10 +9,10 @@ We have lots of client libraries to help you get started with your project:
|
|||
|
||||
* [Ruby](https://github.com/adafruit/io-client-ruby)
|
||||
|
||||
**Note:** The following two libraries use V1 of the Adafruit API which have been [depreciated](https://io.adafruit.com/api/docs/).
|
||||
**Note:** The following two libraries use V1 of the Adafruit API which have been [deprecated](https://io.adafruit.com/api/docs/).
|
||||
|
||||
* [Node.js](https://github.com/adafruit/adafruit-io-node-client)
|
||||
|
||||
* [Go](https://github.com/adafruit/io-client-go)
|
||||
|
||||
They're all open source, so if they don't already do what you want, you can fork them and add any feature you'd like.
|
||||
They're all open source, so if they don't already do what you want, you can fork them and add any feature you'd like.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,24 @@
|
|||
# Activities
|
||||
|
||||
Activities are Adafruit IO's list of actions you've taken to create, update, or
|
||||
delete objects in your Adafruit IO account. We store the last 1000 actions taken for:
|
||||
|
||||
* Dashboards
|
||||
* Blocks
|
||||
* Feeds
|
||||
* Groups
|
||||
* Triggers
|
||||
|
||||
|
||||
|
||||
## All activities for current user
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-get">GET</span> <code class="path">/api/v2/{username}/activities</code></div>
|
||||
|
||||
```shell
|
||||
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activities
|
||||
curl -H "X-AIO-Key: {io_key}" \
|
||||
https://io.adafruit.com/api/v2/{username}/activities
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
@ -15,7 +30,7 @@ $ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activi
|
|||
```ruby
|
||||
```
|
||||
|
||||
> Response Sample:
|
||||
> Response Sample
|
||||
|
||||
```json
|
||||
[
|
||||
|
|
@ -32,28 +47,15 @@ $ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activi
|
|||
]
|
||||
```
|
||||
|
||||
An array of activities
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /{username}/activities`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Query Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
start_time | string | false | Start time for filtering, returns records created after given time.
|
||||
|
|
@ -62,13 +64,11 @@ limit | integer | false | Limit the number of records returned.
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## All activities for current user
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-delete">DELETE</span><code class="path">/api/v2/{username}/activities</code></div>>
|
||||
|
||||
```shell
|
||||
$ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activities
|
||||
```
|
||||
|
|
@ -85,36 +85,24 @@ $ curl -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activi
|
|||
> Response Sample:
|
||||
|
||||
```json
|
||||
|
||||
```
|
||||
|
||||
Deleted activities successfully
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`DELETE /{username}/activities`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Get activities by type for current user
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/activities/{type}</code></div>
|
||||
|
||||
```shell
|
||||
# Returns two records
|
||||
$ curl -F 'limit=2' -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{username}/activities/{type}
|
||||
|
|
@ -149,26 +137,16 @@ $ curl -F 'limit=2' -H "X-AIO-Key: {io_key}" https://io.adafruit.com/api/v2/{use
|
|||
An array of activities
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /{username}/activities/{type}`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
type | string | true |
|
||||
|
||||
|
||||
|
||||
type | string | true |
|
||||
|
||||
|
||||
### Query Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
start_time | string | false | Start time for filtering, returns records created after given time.
|
||||
|
|
@ -176,8 +154,3 @@ end_time | string | false | End time for filtering, returns records created befo
|
|||
limit | integer | false | Limit the number of records returned.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
## All blocks for current user
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks</code></div>
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
|
|
@ -41,31 +44,20 @@
|
|||
An array of blocks
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /{username}/dashboards/{dashboard_id}/blocks`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
dashboard_id | string | true |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dashboard_id | string | true |
|
||||
|
||||
|
||||
|
||||
## Create a new Block
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-post">POST</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks</code></div>
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
|
|
@ -103,39 +95,27 @@ dashboard_id | string | true |
|
|||
New Block
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`POST /{username}/dashboards/{dashboard_id}/blocks`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
dashboard_id | string | true |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dashboard_id | string | true |
|
||||
|
||||
|
||||
### Body Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
block | object | true |
|
||||
|
||||
|
||||
block | object | true |
|
||||
|
||||
|
||||
|
||||
## Returns Block based on ID
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-get">GET</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
|
|
@ -173,32 +153,21 @@ block | object | true |
|
|||
Block response
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET /{username}/dashboards/{dashboard_id}/blocks/{id}`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
|
||||
## Replace an existing Block
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-put">PUT</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
|
|
@ -236,40 +205,28 @@ id | string | true |
|
|||
Updated block
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`PUT /{username}/dashboards/{dashboard_id}/blocks/{id}`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
### Body Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
block | object | true |
|
||||
|
||||
|
||||
block | object | true |
|
||||
|
||||
|
||||
|
||||
## Delete an existing Block
|
||||
|
||||
> HTTP Request
|
||||
> <div class="http"><span class="method-delete">DELETE</span><code class="path">/api/v2/{username}/dashboards/{dashboard_id}/blocks/{id}</code></div>
|
||||
|
||||
```shell
|
||||
```
|
||||
|
||||
|
|
@ -291,26 +248,12 @@ block | object | true |
|
|||
Deleted Block successfully
|
||||
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`DELETE /{username}/dashboards/{dashboard_id}/blocks/{id}`
|
||||
|
||||
|
||||
### Path Parameters
|
||||
|
||||
|
||||
Parameter | Type | Required | Description
|
||||
--------- | ------- | --------- | -----------------------
|
||||
username | string | true | a valid username string
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dashboard_id | string | true |
|
||||
id | string | true |
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ We *strongly* recommend connecting using SSL (Port 8883) if your client allows i
|
|||
| | |
|
||||
|----------------------|---------------------------|
|
||||
| **Host** | io.adafruit.com |
|
||||
| **Port (SSL)** | 8883 |
|
||||
| **Port (insecure)** | 1883 |
|
||||
| **Secure (SSL) Port**| 8883 |
|
||||
| **Insecure Port** | 1883 |
|
||||
| **Username** | Your Adafruit IO Username |
|
||||
| **Password** | Your Adafruit IO Key |
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ toc_footers:
|
|||
- <a href='https://io.adafruit.com/terms'>Adafruit IO ToS</a>
|
||||
- <a href='https://io.adafruit.com/feedback'>Submit Feedback</a>
|
||||
|
||||
|
||||
toc_append:
|
||||
- href: /cookbook.html
|
||||
text: API Cookbook
|
||||
|
||||
includes:
|
||||
- introduction
|
||||
|
|
@ -40,7 +42,6 @@ includes:
|
|||
- mqtt/mqtt_topics.md.erb
|
||||
- mqtt/mqtt_group_topics.md.erb
|
||||
- errors
|
||||
- cookbook.md.erb
|
||||
|
||||
search: true
|
||||
---
|
||||
|
|
|
|||
Loading…
Reference in a new issue