-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f42e794
commit ba5e83a
Showing
4 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
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
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
41 changes: 41 additions & 0 deletions
41
docs/Tutorials/Step 6 - Sending a data ingestion request.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Now that you have a token from Biotz Identity Provider, it is time to send actual data to Biotz. In this tutorial, as said before, you will simulate a device sending data using the terminal. The approach is basically the same as to retrieve a token, just an HTTP request to the **http-forwarder** service. It will take your request and re-route it into a queue to be processed when the system is available. | ||
<br></br> | ||
For the request to be accepted by the **http-forwarder** it needs three things: | ||
- The **id_token**. | ||
- The message type **internal name** for your device. This should be **mytestmessag** if you have been following this tutorial. | ||
- Request **payload**. This is your device’s data. The payload should have the shape/structure of the schema you defined previously. That means, an **Object** containing the keys **hum**, **temp** and **time**. | ||
|
||
In this case the **Object** is an JSON object since the **mytestmessag** definition was configured with the **JSON** encoding. | ||
|
||
<br></br> | ||
Now, the request is very simple, you will send just a single sample of data (a single request in this case) to the platform. Here is an example using both HTTPie and cURL. | ||
|
||
```jsx title="HTTPie" | ||
http --auth-type bearer \ | ||
--auth ~YOUR ID_TOKEN~ \ | ||
POST https://ingestion-http.biotz.io/api/device/publish/data/mytestmessag \ | ||
hum=20.5 temp=25.6 | ||
``` | ||
<br></br> | ||
|
||
```jsx title="cURL" | ||
curl --header "Content-Type: application/json" \ | ||
--header "Authorization: Bearer ~YOUR ID_TOKEN~" \ | ||
--request POST \ | ||
--data '{"hum": 20.5, "temp": 25.6}' \ | ||
https://ingestion-http.biotz.io/api/device/publish/data/~INTERNAL NAME OF MESSAGE_TYPE~ | ||
``` | ||
<br></br> | ||
|
||
The response should look like this: | ||
``` | ||
{ | ||
"success?": true, | ||
"details": {} | ||
} | ||
``` | ||
|
||
If that is the response you got, then the request was successful. Now your data should be available on the platform. To see that, in the next step you will create a dashboard to display your data. | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
In order to display the data you will need to create a dashboard and a panel. A dashboard is a collection of panels. Each panel contains a specific query to display your data. You can also apply different customizations to the panel's appearance. However, the focus of this tutorial is to just display your newly ingested data. Bear in mind that the data you will display is a single point, if you have followed this tutorial. Displaying a single point is not very useful but the end goal is to learn how it works. So, later on when you create your real dashboard panels you have a good foundation to do so. | ||
|
||
<br></br> | ||
|
||
To create a new dashboard, from the sidebar, click on the **Dashboards** section. This will open the dashboards list. In the top right corner, click on **New dashboard**. Give it the name **My test dashboard** and the same value for **Description**. | ||
|
||
<center><img src="/img/NewDashboard.png" alt="New Dashboard"></img></center> | ||
|
||
Click on create and now you have a dashboard. The dashboard alone is not really useful, so let us create a panel in it. On the dashboard list, click on the dashboard name. This will lead you to the dashboard view. On the top right corner, click on **New panel**. This will open a dropdown with the panel type options you can choose. For the purpose of this tutorial, select **Time series**. | ||
|
||
<br></br> | ||
|
||
Once you are in the panel creation page you will see on the left the panel basic information form, such as **Name** and **Description**. Fill both fields with **My test panel** value. To the right, you will have the query builder. The query builder will allow you to define what the panel should display. Configure the query builder with the following settings: | ||
|
||
**Query 1** | ||
|
||
- **Name: Humidity Mean** | ||
- **Select device: My test device** | ||
- **Select message type: My test message type** | ||
- **Select attribute: humidity** | ||
- **Select aggregation method: Mean** | ||
|
||
<center><img src="/img/Query1.png" width="800" height="261" alt="Query 1"></img></center> | ||
|
||
You can also change the appearance of the panel but that is out of the scope for this tutorial. As you can see, you can also add more queries to the panel but in this tutorial we want to make it simple and go with just a single query. | ||
|
||
<br></br> | ||
|
||
Once you fill the query builder with the details above click on **Save**. This will create the panel and it should display a single data point in your. | ||
|
||
<center><img src="/img/MyTestPanel.png" alt="My test panel"></img></center> | ||
|
||
If it says “No data to show” please make sure the time filter, found in the top right toolbar, is set to a smaller time range, for example 30 minutes. | ||
|
||
<center><img src="/img/TimeFilter.png" alt="Time Filter"></img></center> | ||
|
||
If everything is correct, you should see the data point you just sent to the platform a few minutes ago. | ||
|
||
**Congratulations!** | ||
|