Wiki source code of Session Key

Last modified by Alex Chang on 2022/04/07 09:17

Show last authors
1 === Get WLINK Session Key ===
2
3 To use WLINK Service have to get session Key
4
5 **URL** :  ##/v1/session/:apikey##
6 **Method** : ##POST##
7 **Auth required** : ##NO##
8 **URL parameters**
9
10 (% class="box" %)
11 (((
12 * apikey : API Key value from /api/getKey
13 )))
14
15 ====== Data constraints ======
16
17 {{code language="json"}}
18 {
19 "uuid": "[valid device uuid]",
20 "time": "[YYYYMMDDHHmmss+ZZZZ]",
21 "service_code" : "[valid service code]",
22 "service_tag" : "[valid service tag]",
23 "auth": "[valid auth value]"
24 }
25
26 {{/code}}
27
28 * auth : hmac_md5(time+service_code+service_tag+uuid+key, secret). Hex String Format
29
30 ====== Data example ======
31
32 {{code language="json"}}
33 {
34 "uuid": "uuid1",
35 "time": "20161126095000+0800",
36 "service_code" : "WLINK_XXXXX",
37 "service_tag" : "ilovewinstars",
38 "auth": "7a0ad58efc8dfdec4bb2a353b3746a41"
39 }
40
41 {{/code}}
42
43 ----
44
45 ===== Success Response =====
46
47 **Code** : ##200 OK##
48 **Content example**
49
50 {{code language="json"}}
51 {
52 "service_code": "WLINK_XXXXX",
53 "uuid": "uuid1",
54 "key": "WLINK_XXXXX56e9a5073bae54b7bb8e0b05",
55 "session_key": "db75e2819e615584591461252bca504a",
56 "session_time": "20161126123042+0800"
57 }
58
59 {{/code}}
60
61 ----
62
63 ==== Error Response ====
64
65 **Condition** : Invalid Message Format or Service Code.
66 **Code** : ##400 BAD REQUEST##
67 **Content** :
68
69 {{code language="json"}}
70 {
71 }
72 {{/code}}
73
74 ===== Remark: =====
75
76 {{info}}
77 The session key is valid before the session time. You can call this URL again to update it. if you call this URL for the last 30 mins, the session key is not changed. The system will return the same session key value.
78 {{/info}}