Anda di halaman 1dari 4

How to push hardware observation events to a care recipient using Postman

Installation:

1. Download the Postman using the link https://www.getpostman.com/downloads/


2. Choose the downloaded version based windows 32bit/64bit
3. Click on ‘Run’ in the popup.

Sign in:

1. Sign in to the application using valid Email, Username and Password.


2. Click on ‘Set Up Later’ in Welcome Page.
3. Click on ‘Skip For now’ in ‘Set up your postman team’ page.

Procedure:

1. Choose ‘POST’ under Get dropdown


2. Enter https://staging.mybirdie.io/oauth/token under ‘Enter request url’.
3. Choose ‘Headers’
4. Enter (Content-Type: application/json) ‘Key’ as Content-Type and ‘Value’ as
application/json
5. Choose ‘Body’
6. Choose ‘Raw’ and ‘JSON (application/json) from dropdown.
7. Enter the code as

"client_id": "datapipeline",

"client_secret": "YMchtvaarS5NzhL27QIDt1k94zuXZWFd2Yuq",

"grant_type": "client_credentials"

8. Click on ‘Send’ and observe the response as


{
"access_token":
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NDk1MzI3NTMsInN1YiI6ImRh
dGFwaXBlbGluZSIsImNsaWVudF9pZCI6ImRhdGFwaXBlbGluZSIsImdyYW50cyI6WyJjb
GllbnRfY3JlZGVudGlhbHMiXSwiZXhwIjoxNTQ5NTU0MzUzfQ.qZDsUR2y3ASzIEApx4pL
n_4civSFwvPEwVec_48EH_0",
"expires_at": "2019-02-07T15:45:53.000Z",
"token_type": "Bearer"
}
9. Open New request by clicking on ‘+’ icon.
10. Choose ‘POST’ under Get dropdown
11. Enter https://staging.mybirdie.io/collect under ‘Enter request url’.
12. Choose ‘Authorization’ and choose ‘Bearer Token’ under ‘Type’.
13. Copy the ‘Access token’ and paste it under ‘Token’.
14. Click on ‘Preview Request’ button.
15. Click on ‘Headers’ and observe the ‘Authorization’ key and value present in first row.
16. Click on ‘Key’ field in second row and Enter ‘Key’ as Content-Type and ‘Value’ as
application/json
17. Click on ‘Body’
18. Choose ‘Raw’ and ‘JSON (application/json) from dropdown.
[
{
"id": "300507ae-12d0-41b3-9955-ca4f786797f9",
"event_type": "outside_bedroom",
"timestamp": "2019-02-15T11:00:00+00:00",
"care_recipient_id": "fbf1ac47-d7a0-4c21-acc2-1e235d97752c",
"monitoring_start_at": "2019-01-14T23:00:00-00:01",
"monitoring_end_at": "2019-01-15T10:00:00-00:01",
"total_amount_of_time_outside_bedroom_in_seconds": 5797,
"configured_maximum_total_time_outside_bedroom_in_seconds": 2700
},
{
"id": "300507ae-12d0-41b3-9956-ca4f786797f9",
"event_type": "important_sleep_duration_variation_measured",
"timestamp": "2019-02-15T11:00:00+00:00",
"care_recipient_id": "2ae7037f-04ab-4a0e-aae6-69abb6a8f62c",
"total_sleep_duration_in_seconds": 21816,
"last_days_average_total_sleep_duration_in_seconds": 32248,
"monitoring_start_at": "2019-01-14T23:00:00-00:01",
"monitoring_end_at": "2019-01-15T10:00:00-00:01",
"configured_number_of_days_for_comparison": 6,
"configured_minimum_variation_to_generate_observation": 0.35,
"configured_minimum_duration_in_bedroom_considered_as_sleep_in_
seconds": 1600
},
{
"id": "300507ae-12d0-41b3-9957-ca4f786797f9",
"event_type": "care_recipient_return_overdue",
"timestamp": "2019-02-15T11:00:00+00:00",
"care_recipient_id": "2ae7037f-04ab-4a0e-aae6-69abb6a8f62c",
"monitoring_start_at": "2019-01-14T23:00:00-00:01",
"monitoring_end_at": "2019-01-15T10:00:00-00:01",
"last_house_activity_at": "2019-01-15T10:20:00+00:00",
"configured_maximum_time_outside_in_seconds": 1800
},
{
"id": "300507ae-12d0-41b3-9958-ca4f786797f9",
"event_type": "no_recent_activity_in_bathroom_or_toilet",
"timestamp": "2019-02-15T08:49:37+01:00",
"care_recipient_id": "2ae7037f-04ab-4a0e-aae6-69abb6a8f62c",
"last_activity_at": "2019-01-14T19:49:37+01:00",
"configured_maximum_time_between_bathroom_or_toilet_visits_in_s econds":
43200
},
{
"id": "380F0CE3-3D47-4E3A-BE05-28686F03FFE4",
"event_type": "door_opened",
"timestamp": "2018-09-13T11:49:37+01:00",
"care_recipient_id": "897e753e-80df-4c21-9df2-a5c8b71c0405",
"location": "back"
},
{
"id": "380F0CE3-3D47-4E3A-BE05-28686F03FFE4",
"event_type": "door_closed",
"timestamp": "2018-09-13T11:49:37+01:00",
"care_recipient_id": "897e753e-80df-4c21-9df2-a5c8b71c0405",
"location": "front"
}
{
"id": "300507ae-12d0-41b3-9958-ca4f786797f2",
"event_type": "abnormal_time_in_bathroom",
"timestamp": "2019-02-06T10:49:37+01:00",
"care_recipient_id": {CONNECTED_RECIPIENT_ID},
"entered_bathroom_at": "2019-02-07T02:49:37+01:00",
"configured_maximum_time_in_bathroom_in_seconds": 43200
}
{
"id": "16e884da-96e6-4b18-8bda-6e56d4ef8278",
"event_type": "left_home",
"timestamp": "2019-02-13T11:49:37+01:00",
"care_recipient_id": "71ea09f7-6da1-490c-b637-8580bcbac670",
"left_home_at": "2019-02-12T11:49:37+01:00"
}
]

19. Replace care recipient id by the id you want the events for.
20. IMPORTANT: Do not forget to change the id field each time; any duplicate event id
will not be saved, even if valid. You can use an id generator,
https://www.uuidgenerator.net/
21. Replace timestamp by the date you want the event to be emitted for. When
relevant, also update monitoring start at and monitoring end at to stay consistent.
You have to keep the ISO format.
22. Response (any mistake in the format will be described in the errors field.)
[
{
"isValid": true,

"errors": []
}, // as many time as the number of events you sent.

Anda mungkin juga menyukai