Skip to content

Commit

Permalink
v 1.0.0
Browse files Browse the repository at this point in the history
Added authorization on API
  • Loading branch information
irritanterik committed Apr 25, 2016
1 parent 9ed5b88 commit 886c3a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ condition or execute a HTTP request as a flow action with this app.
### Action cards
- HTTP Delete
- HTTP Get
- HTTP Get JSON (for query parameters like ?a=1&b=zz use {"a":1,"b":"zz"})
- HTTP Get JSON (for query parameters like ?a=1&b=zz use ```{"a":1,"b":"zz"}```)
- HTTP Put JSON
- HTTP Post Form (content-type 'application/x-www-form-urlencoded')
- HTTP Post JSON (content-type 'application/json')
Expand All @@ -29,12 +29,14 @@ The paired action and trigger cards GET variable step 1/2 enables you to get a v

The action card has four parameters:
1. Url
2. JSON encoded query parameters: ?a=1&b=zz use {"a":1,"b":"zz"})
2. JSON encoded query parameters: ?a=1&b=zz use ```{"a":1,"b":"zz"}```)
3. [JSONpath formatted](http://jsonpath.com/) expression of desired value. The result of this expression must be a single value.
4. Name of trigger/event for step 2

When this cards executes succesfull, it will start flows with the 'GET variable step 2' trigger card and same trigger/event as step 1. The result of the JSONpath expression is available as a token on the card.

#### Note
Passing a valid JSON string (at least {} ) is obligatory for cards with a JSON parameter.
#### Notes
Passing a valid JSON string (at least ```{}``` ) is obligatory for cards with a JSON parameter.

API calls requires header ```Authorization``` with value ```Bearer <token>```, where <token> is your secret token (get it by typing ```window.bearer_token``` in the chrome console while logged in on your Homey).
Happy hacking!
4 changes: 2 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = [
description: "HTTP Get trigger card",
method: "GET",
path: "/:event",
requires_authorization: false,
requires_authorization: true,
fn: function( callback, args ){
Homey.manager('flow').trigger('http_get'
,{'value': 'null'}
Expand All @@ -16,7 +16,7 @@ module.exports = [
description: "HTTP Get trigger card with value",
method: "GET",
path: "/:event/:value",
requires_authorization: false,
requires_authorization: true,
fn: function( callback, args ){
Homey.manager('flow').trigger('http_get'
,{'value': args.params.value}
Expand Down
11 changes: 1 addition & 10 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id":"com.internet",
"version":"0.6.2",
"version":"1.0.0",
"compatibility":">=0.8.20",
"name":{
"en":"HTTP request flow cards",
Expand All @@ -14,15 +14,6 @@
"name":"Erik van Dongen",
"website":"http://github.com/irritanterik/"
},
"contributors":{
"developers":[
{
"name":"El Genio",
"website":"https://github.com/elgenioNL",
"email":"[email protected]"
}
]
},
"images":{
"large":"./assets/images/large.jpg",
"small":"./assets/images/small.jpg"
Expand Down

0 comments on commit 886c3a4

Please sign in to comment.