Skip to content

Commit 15b8b5b

Browse files
author
Renat Zubairov
committed
Update api_tutorial.md
1 parent 4b289f7 commit 15b8b5b

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

api_tutorial.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You only need a ``curl`` and [elastic.io account](http://www.elastic.io) for tha
88
Create new request bin, we'll going to use it in our integration sample to push the data.
99

1010
```
11-
curl -X POST http://requestb.in/api/v1/bins
11+
curl -X POST http://requestb.in/api/v1/bins
1212
```
1313

1414
you'll ge a response that would looks like this:
@@ -26,7 +26,7 @@ you'll ge a response that would looks like this:
2626
}
2727
```
2828

29-
Remember the ``name`` of your bin. You can also check it's empty now:
29+
Remember the ``name`` of your bin (``xuhpomxu`` in our sample above). You can also check it's empty now:
3030

3131
```
3232
curl http://requestb.in/api/v1/bins/xuhpomxu
@@ -63,6 +63,7 @@ First create a new file called ``task.json`` with following content:
6363
```json
6464
{
6565
"name": "Embedded Tutorial",
66+
"cron": "*/1 * * * *",
6667
"nodes": [
6768
{
6869
"action": "elasticio/timer:timer",
@@ -98,7 +99,7 @@ And you'll see the result like this:
9899
{"id":"123456789"}
99100
```
100101

101-
We just created a new task. Now we can start it.
102+
We just created a new task with ``id`` 123456789. Now we can start it.
102103

103104
## Start integration flow
104105

@@ -120,8 +121,51 @@ As a response you'll see something like this:
120121
}
121122
```
122123

124+
Your first integration task has just started on elastic.io. Every minute elastic.io platform will trigger an execution of the [timer component](https://github.com/elasticio/timer). Timer component [will emit](https://github.com/elasticio/timer/blob/master/timer.js#L27) a message with the fire time in it, this message will be placed into the output data queue which is in turn connected to the [webhook component](https://github.com/elasticio/webhook) which will POST the body of the message to the configured URL.
125+
123126
## See your integration flow working
124127

128+
After 10-15 seconds you can check the request bin you created in the first step of this tutorial:
129+
130+
```
131+
curl http://requestb.in/api/v1/bins/xuhpomxu
132+
```
125133

126134

135+
```json
136+
{
137+
"name": "xuhpomxu",
138+
"request_count": 1,
139+
"color": [
140+
240,
141+
220,
142+
190
143+
],
144+
"private": false
145+
}
146+
```
147+
148+
As you can see we have a new request in the bin. You can also open a URL in your browser ``http://requestb.in/your-bin-name?inspect`` to see the visualization statistics like this:
149+
127150
https://www.dropbox.com/s/3u8kqc58b8v24z9/Screenshot%202016-01-30%2012.50.48.png?dl=0
151+
152+
And you can be sure every minute a new request will be posted.
153+
154+
## Stop your integration flow
155+
156+
Don't forget to stop your task so that resources allocated to your account won't be wasted, use the [stop task](http://api.elastic.io/docs/#stop-a-task) API:
157+
158+
```
159+
curl -u your-email:your-api-key \
160+
-X POST \
161+
https://api.elastic.io/v1/tasks/stop/{TASK_ID}
162+
```
163+
164+
As a response you'll see something like this:
165+
166+
```json
167+
{
168+
"id": "123456789",
169+
"status": "inactive"
170+
}
171+
```

0 commit comments

Comments
 (0)