-
Notifications
You must be signed in to change notification settings - Fork 2
/
apiary.apib
863 lines (662 loc) · 29.8 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
FORMAT: 1A
HOST:https://et.udc-service.io:5000
# Energy Trading (ET) API Document
ET's back-end API<p>
API-version: 0.1
# Group Restful
## Login [/login]
Used to login platform.
### Login [POST]
<pre>
curl https://et.udc-service.io:5000/login -X POST -H "Content-Type: application/json" -d '{"account": "TestA1", "password": "TestA1"}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
+ Attributes
+ account: `TestA1` - Login Account
+ password: `TestA1` - Account's Password
+ Response 200 (application/json)
+ Attributes
+ id: `03f87a5a-a4e6-4536-ba6c-265c03ebd317` - User's UUID
+ bearer: `OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR` - Authentication Bearer Token
+ Response 401 (application/json)
+ Attributes
+ error: `Unauthorized access` - Authentication failed
## User [/user]
User's information.
### User Info [GET]
<pre>
curl https://et.udc-service.io:5000/user -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ account: `TestA1_BEMS`
+ username: `TestA1`
+ avatar: `https://imgur.com/0JMAdHM` - Profile Picture's URL
+ balance: `100` (number) - User's Token balance
+ address: `台南市大學路一號` - User's Building Address
+ eth_address: `0xB346ef4EEFc02FdAa7b4756Db4F30E0cdA9704Ae` - User's ETH Address
+ is_aggregator: `true` - User's aggregator authority
### Change Password [PUT]
<pre>
curl https://et.udc-service.io:5000/user -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR" -d '{"original_passwd": "TestA1","new_passwd": "new_password"}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Attributes
+ original_passwd: `User1pwd` - User input original password
+ new_passwd: `User1new` - User input new password
+ Response 200 (application/json)
+ Attributes
+ message: Accept.
+ Response 400 (application/json)
+ Attributes
+ message: Fail. - Error Message
### Create User [POST]
<pre>
curl https://et.udc-service.io:5000/user -X POST -H "Content-Type: application/json"
-d '{
"account": "TestA1",
"username": "TestA1_BEMS",
"password": "test"
}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
+ Attributes
+ account: `TestA1` - Account name, ID
+ username: `TestA1` - Account username
+ password: `test` - Account password
+ Response 200 (application/json)
+ Attributes
+ message: Account created
+ Response 400 (application/json)
+ Attributes
+ message: `{error-message}` - Error Message
## AMI [/amis]
Get User's AMIs.
### AMIs [GET]
<pre>
curl https://et.udc-service.io:5000/amis -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (object)
+ id: `a6d2a4cd-fc78-4636-9c42-c0006976244b` - UUID
+ name: `智駕車BEMS`
+ description: `智駕車總表AMI` - AMI 名稱
## News [/news]
Get latest ten system news.
### News [GET]
<pre>
curl https://et.udc-service.io:5000/news -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (object)
+ id: `5f3276c2-ec53-4dd3-ada3-081ca3f9d4f9` - The news' UUID
+ time: `2019/08/25 10:00` - The Message Upload Date
+ content: `Website Upload to Version 0.2` - The Message Content
## Bid Status [/bidstatus]
Related to bidding page info.
### Bidding Status [GET /bidstatus]
<pre>
curl https://et.udc-service.io:5000/bidstatus -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc"
</pre>
Return the average bidding price and active participants in the active hour.
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ average_price: `7.3` (number) - 在下一個有效的執行時段,參與者的平均競標單價
+ average_volume: `15` (number) - 在下一個有效的執行時段,參與者的平均競標電量
+ participants: `2` (number) - 在下一個有效的執行時段,投標的參與者數目
## Bid Submit [/bidsubmit]
Related to bidding.
### Bidding Project [GET /bidsubmit{?per_page}{?page}{?bid_type}]
<pre>
curl https://et.udc-service.io:5000/bidsubmit?per_page=10&page=5&bid_type=buy -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc"
</pre>
Return the bid content valid from the day (Today, current time).
+ Parameters
+ per_page: `10` (number) - 一頁的標案數量.
+ page: `5` (number) - 頁面數.
+ bid_type: `buy` (string) - 取得買或賣的標案資料
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ data (array) - 頁面所顯示的標案資訊
+ (BidSubmit) - 第一筆資料
+ (BidSubmit) - 第二筆資料
+ bid_type: `sell` (string) - 投標類型
+ page: `1` (number) - 所在頁數
+ totalCount: `20` (number) - 在當時間總共有效的標案
### Order [POST]
<pre>
curl https://et.udc-service.io:5000/bidsubmit -X POST -H 'Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc' -H 'Content-Type: application/json' \
-d '{
"bid_type": "buy",
"start_time": "2019/10/29 18",
"end_time": "2019/10/29 19",
"value": 10,
"price": 6.8
}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Attributes
+ bid_type: `buy` - Bidding type: sell or buy
+ start_time: `2019/09/01 13` - Bidding Datetime Start
+ end_time: `2019/09/01 14` - Bidding Datetime End
+ value: `10` (number) - kWh
+ price: `4.3` (number) - NT Dollars
+ Response 200 (application/json)
+ Attributes
+ message: Accept
+ Response 400 (application/json)
+ Attributes
+ message: Reject
### Edit [PUT]
<pre>
curl https://et.udc-service.io:5000/bidsubmit -X PUT -H 'Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc' -H 'Content-Type: application/json' \
-d '{
"id": "2048b3c9-0125-41fc-bef6-9b1e52bd825f",
"bid_type": buy,
"start_time": "2019/10/29 18",
"end_time": "2019/10/29 19",
"value": 10,
"price": 6.8
}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Attributes
+ id: `104fa450-c688-4f7f-8cca-fae7a18f2eb8` - Item's UUID
+ bid_type: `buy` - Bidding type: sell or buy
+ start_time: `2019/09/01 13` - Bidding Datetime Start
+ end_time: `2019/09/01 14` - Bidding Datetime End
+ value: `10` (number) - kWh
+ price: `4.3` (number) - NT Dollars
+ Response 200 (application/json)
+ Attributes
+ message: Accept
+ Response 400 (application/json)
+ Attributes
+ message: Reject
### Remove [DELETE]
<pre>
curl https://et.udc-service.io:5000/bidsubmit -X DELETE -H 'Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc' -H 'Content-Type: application/json' -d '{"id": "104fa450-c688-4f7f-8cca-fae7a18f2eb8"}'
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Attributes
+ id: `104fa450-c688-4f7f-8cca-fae7a18f2eb8` - Remove item's UUID
+ Response 200 (application/json)
+ Attributes
+ message: Accept
+ Response 400 (application/json)
+ Attributes
+ message: Reject
+ description: The bid has been closed - Error message
## Home Page [/homepage]
Return information for home page.
### Home Page [GET]
<pre>
curl https://et.udc-service.io:5000/homepage -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc"
</pre>
Return detail information sets for home page which includes current execution info and 10 most recent succuessful bid results (if any).
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ buy - 首頁即時買電交易資訊 (當時段執行買電的資料,若沒有買電,以下皆 null)
+ price: 4.0 (number) - 交易價錢
+ volume: 40 (number) - 交易電量
+ sell - 首頁即時賣電交易資訊 (當時段賣電的資料,若沒有賣電,以下皆 null)
+ price: 4.0 (number) - 交易價錢
+ volume: 40 (number) - 交易電量
+ results (array) - 最近十筆得標成功的資料 (if any)
+ (HomepageBid) - 第一筆資料
+ (HomepageBid) - 第二筆資料
+ time: `13:00-14:00`
## Match Result [/matchresult]
Return match results.
### Match Result [GET]
<pre>
curl https://et.udc-service.io:5000/matchresult -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc"
</pre>
Return details information sets of the user's bids.
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (BID)
## Schematic Diagram [/participant]
Return participants in the transaction to paint schematic diagram.
### Participants [GET]
<pre>
curl https://et.udc-service.io:5000/participant -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (object)
+ id: `7e54877b-3743-4d20-bbfc-5b4deb131116` - User's UUID
+ name: `BEMS1`
## Power Info [/power_info]
Return Electricity History Usage.
### PowerData (Data Table Mode) [GET /power_info{?per_page}{?page}{?time}]
<pre>
curl https://et.udc-service.io:5000/power_info?per_page=10&page=1&time=2020/02/14 -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Parameters
+ per_page: `10` (number, required) - Power data per page.
+ page: `1` (number, required) - Power data at page.
+ time: `2020/02/14` (string, optional) - Date for the data, default is now, format YYYY/MM/DD.
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ data (array) - 頁面所顯示的電力資訊
+ (PowerEntry) - 第一筆資料
+ (PowerEntry) - 第二筆資料
+ time: `23:51`
+ id: `049a9c28-c0cc-418e-9f35-23f6bc43df7e`
+ page: `1` (number) - 所在頁數
+ totalCount: `785` (number) - Query 時間內資料總數
### PowerData (Data Chart Mode) [GET /power_info{?chart_date}]
<pre>
curl https://et.udc-service.io:5000/power_info?chart_date=2020/01/13 -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
Return past 7 days power information.
+ Parameters
+ chart_date: `2020/02/14` (string, required) - Date for the data, format YYYY/MM/DD.
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (ChartData)
+ Date: `2020/02/08`
+ (ChartData)
+ Date: `2020/02/09`
+ (ChartData)
+ Date: `2020/02/10`
+ (ChartData)
+ Date: `2020/02/11`
+ (ChartData)
+ Date: `2020/02/12`
+ (ChartData)
+ Date: `2020/02/13`
+ (ChartData)
+ Date: `2020/02/14`
### PowerData (Date Summary Mode) [GET /power_info{?summary_date}]
<pre>
curl https://et.udc-service.io:5000/power_info?summary_date=2020/02/14 -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
+ Parameters
+ summary_date: `2020/02/14` (string, required) - Date for the data, format YYYY/MM/DD.
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Response 200 (application/json)
+ Attributes
+ Consume: `48.19` (number) - 正常用電
+ Demand: `47.208` (number) - 總淨負載
+ ESS: `0.219` (number) - 儲電系統
+ EV: `2.017` (number) - 充電樁
+ PV: `-3.501` (number) - 太陽能
+ WT: `0.283` (number) - 風能
# Group Web Socket
## Association Diagram [/s1]
Return transaction status.
### Association [OPTIONS /socket/association]
<pre>
NOT YET !!!!!!
</pre>
+ Request (application/json)
+ Headers
API-version: 0.1
Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR - Authentication Bearer Token
+ Attributes
+ event: association - Socket Event Name
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (object)
+ seller: `e900b7b0-c097-4ce8-9426-7399d6412b26` - Seller's UUID
+ buyer: `9eef88ba-abf3-4cdc-a2cc-c63e331c4c47` - Buyer's UUID
+ value: `10` (number) - win value
+ achievement: `4` (number)
## Data Structures
### BID (object)
+ id: `b345273d-ffc9-4916-bf7e-5615f0ee8a39` - Message's UUID
+ date: `2019/09/01` - Trade Target Date
+ time: `13:00-14:00` - Trade Period
+ bid_type: `sell` - sell or buy
+ bids
+ price: `5.0` (number) - Bidding Price
+ value: `20.0` (number) - Bidding Value
+ status: `已結算` - Bidding Status
+ transaction_hash: `0xdb13d6c572a482f2a9578bfb3cc41a2f0e349852138e788db795ee51ce40b439` - Transaction Hash
+ counterpart
+ name: 沙崙綠能科學城C區BEMS
+ address: 台南市歸仁區高發二路360號C區
+ win: `1` (number) - Deal or No Deal
+ wins
+ value: `10` (number) - Winning Value
+ price: `50` (number) - Winning Total Price
+ upload: `Thu, 12 Mar 2020 14:15:00 GMT` - Upload Time
+ achievement: `100%` - 0~100%
+ settlement: `50` (number) - Settlement Transaction Price
### BidSubmit
+ bid_type: `buy` (string) - 投標類型
+ date: `2020/10/29` (string) - 目標執行日期 YYYY/MM/DD
+ end_time: `2020/10/29 19` (string) - 執行結束時間
+ id: `049a9c28-c0cc-418e-9f35-23f6bc43df7e` - 投標 UUID
+ price: `6.8` (number) - 投標單價
+ start_time: `2020/10/29 18` (string) - 執行開始時間
+ time: `18` (number) - 執行時間
+ total_price: `68.0` (number) - 總交易價格
+ upload_time: `Sat, 21 Mar 2020 14:28:59 GMT` (string) - 投標上傳時間
+ volume: `10` (number) - 投標電量
### ESS
+ table: `ess`
+ id: `486fbca4-9bc1-42bd-af93-92ceb77d89ec` - Data's UUID
+ field: `NCKU` (string) - 場域
+ cluster: `1` (number) - ESS編號
+ power_display: `-0.035` (number) - 讀取實功輸出(kW)
+ updated_at: `2019-09-04T12:00:00` - 資料上傳時間
### EV
+ table: `ev`
+ id: `c363a32e-3dbe-42c5-bfe2-398436192c6f` - Data's UUID
+ field: `NCKU` (string) - 場域
+ cluster: `1` (number) - 充電柱編號
+ power_display: `0.000` (number) - 充電功率(kW)
+ updated_at: `2019-09-04T12:00:00` - 資料上傳時間
### PV
+ table: `pv`
+ id: `e257ccca-409a-4297-a6c2-c6d91b6dd334` - Data's UUID
+ field: NCKU (string) - 場域
+ cluster: `1` (number) - 太陽能編號
+ PAC: 0.000 (number) - 市電功率
+ updated_at: `2019-09-04T12:00:00` - 資料上傳時間
### WT
+ table: `wt`
+ id: `c15107ab-afed-4d9c-a123-ca6d0626d868` - Data's UUID
+ field: `NCKU` (string) - 場域
+ cluster: `1` (number) - 風機編號
+ WindGridPower: `0.000` (number) - 風機功率
+ updated_at: `2019-09-04T12:00:00` - 資料上傳時間
### PowerEntry
+ address: `https://thetangle.org/transaction/WGQEE9ZNHHNPZ9AILVK9NAUXTRQZWJVEMIXWPBMWFQZTRXLIURDKLVUKACJAQIJOCKDWAZTLTLZY99999` - IOTA address
+ data_type: `ESS` - 產能設備
+ date: `2020/02/14` - 日期
+ id: `049a9c28-c0cc-418e-9f35-23f6bc43df7e` - PowerData UUID
+ power_display: `4.771` (number) - 電力資訊
+ time: `23:50` - 時間
### ChartData
+ Consume: `47.823` (number) - 用電
+ Date: `2020/01/07` - 日期
+ Demand: `49.044` (number) - 淨負載
+ ESS: `2.245` (number) - 儲能裝置
+ EV: `-0.499` (number) - 充電樁
+ Generate: `1.221` (number) - 產電
+ PV: `0.053` (number) - 太陽能
+ WT: `-0.578` (number) - 風能
# Group DR
## Demand Response Bids [/DR_bid]
Demand response operation API for both Aggregator (CEMS) and BEMS.
### GET DR BIDS [GET /DR_bid{?date}]
<pre>
curl https://et.udc-service.io:5000/DR_bid?date=2020-01-01 -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
For BEMS, they can only get bids submitted by themselves.
* Parameters: date
* Description: getting bids that event times are from start_time to end_time
For Aggregator (CEMS) , they can get bids from bems which under its supervision.
* Parameters: date
* Description: getting bids that event times are from start_time to end_time
Note:
* Aggregator can get bids from all its executors. (Maybe more than 1 executors at a time)
+ Parameters
+ date: `2020-01-01` (required, string) - query date (YYYY-MM-DD)
+ Request
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (BEMSBID)
+ uuid: `36d87673-0daf-4ce2-917e-ec6d655d3c0a` (string) - bid uuid
+ executor: `NCKU` (string) - Name of BEMS
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 40 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ (BEMSBID)
+ uuid: `515ae958-187a-4503-815f-379d728390b1` (string) - bid uuid
+ executor: `NCKU` (string) - Name of BEMS
+ start_time: `2020-11-11 12:00:00` (string) - DR start time
+ end_time: `2020-11-11 13:00:00` (string) - DR end time
+ volume: 50 (number) - bidding capacity
+ price: 6 (number) - bidding price
+ (BEMSBID)
+ uuid: `ca45ecc1-13a1-4a93-b047-857be806b764` (string) - bid uuid
+ executor: `Carlab_BEMS` (string) - Name of BEMS
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 30 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ Response 400 (text/plain)
+ body
error
### POST DR BID [POST /DR_bid]
For BEMS: This route is to post DR request to Aggregator
For Aggregator: This route is to accept and confirm bems' submitted bids, so aggregator should provide
uuids on those bids he/she wants to accept.
+ Request BEMS (application/json)
BEMS Add DR
<pre>
curl https://et.udc-service.io:5000/DR_bid -X POST -H 'Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc' -H 'Content-Type: application/json' \
-d '{
"value": 50,
"price": 8
}'
</pre>
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR`
+ Attributes
+ volume: 50 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ Request Aggregator (application/json)
Aggregator Accept DR
<pre>
curl https://et.udc-service.io:5000/DR_bid -X POST -H 'Authorization: Bearer 3MaTIcta709SxWZ88OkaLjKvNzgfFkxqr8WemUjeOKLZcImscV6WcziuFyfrbXjc' -H 'Content-Type: application/json' \
-d '{
"start_time": "2020-11-11 11:00:00",
"end_time": "2020-11-11 12:00:00",
"uuid": [
"36d87673-0daf-4ce2-917e-ec6d655d3c0a",
"ca45ecc1-13a1-4a93-b047-857be806b764"
]
}'
</pre>
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR`
+ Attributes
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ uuid (array, fixed-type)
- `36d87673-0daf-4ce2-917e-ec6d655d3c0a` (string)
- `ca45ecc1-13a1-4a93-b047-857be806b764` (string)
+ Response 200 (text/plain)
+ body
ok
+ Response 400 (text/plain)
+ body
error
## Demand Response Result [/DR_result]
Demand response operation API for both Aggregator (CEMS) and BEMS.
### BEMS DR RESULTS BY DATE [GET /DR_result{?start_date}{?end_date}]
<pre>
curl https://et.udc-service.io:5000/DR_result?start_date=2020-01-01&end_date=2020-01-02 -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
For BEMS: They can only see their own DR bid result.
For Aggregator: He/she can query all bid result for bems under his/her management (its executors).
+ Parameters
+ start_date: `2020-01-01` (required, string) - query start time (YYYY-MM-DD)
+ end_date: `2020-01-02` (required, string) - query end time (YYYY-MM-DD)
+ Request BEMS DR RESULTS
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR
+ Parameters
+ start_date: `2020-01-01` (required, string) - query start time (YYYY-MM-DD)
+ end_date: `2020-01-02` (required, string) - query end time (YYYY-MM-DD)
+ Response 200 (application/json)
200 OK (BEMS DR RESULTS)
+ Attributes (array, fixed-type)
+ (BIDRESULT)
+ uuid: `36d87673-0daf-4ce2-917e-ec6d655d3c0a` (string) - uuid
+ executor: `NCKU` (string) - BEMS name
+ acceptor: `Carlab_BEMS` (string) - CEMS name
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 40 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ result: true (boolean) - bool
+ rate: 0.11 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0xc94ec346cea143d8aab07e3a23a9f24031a9a9ae5b9717d99cf32ac0f57a920d` (string) - url
+ (BIDRESULT)
+ uuid: `515ae958-187a-4503-815f-379d728390b1` (string) - uuid
+ executor: `NCKU` (string) - BEMS name
+ acceptor: `Carlab_BEMS` (string) - CEMS name
+ start_time: `2020-11-11 12:00:00` (string) - DR start time
+ end_time: `2020-11-11 13:00:00` (string) - DR end time
+ volume: 50 (number) - bidding capacity
+ price: 6 (number) - bidding price
+ result: false (boolean) - bool
+ rate: 0 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0x07178bc6d022a826d7f85b64f00b77bf878d04519cfbdc6e33aacd802b191435` (string) - url
+ Request Aggregator DR RESULTS
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR
+ Parameters
+ Parameters
+ start_time: `2020-01-01 11:00` (required, string) - query start time (YYYY-MM-DD HH:mm)
+ end_time: `2020-01-01 12:00` (required, string) - query end time (YYYY-MM-DD HH:mm)
+ Response 200 (application/json)
200 OK (Aggregator DR RESULTS)
+ Attributes (array, fixed-type)
+ (BIDRESULT)
+ uuid: `36d87673-0daf-4ce2-917e-ec6d655d3c0a` (string) - bid uuid
+ executor: `NCKU` (string) - Name of BEMS
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 40 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ result: true (boolean) - bool
+ rate: 0.11 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0xc94ec346cea143d8aab07e3a23a9f24031a9a9ae5b9717d99cf32ac0f57a920d` (string) - url
+ (BIDRESULT)
+ uuid: `515ae958-187a-4503-815f-379d728390b1` (string) - bid uuid
+ executor: `NCKU` (string) - Name of BEMS
+ start_time: `2020-11-11 12:00:00` (string) - DR start time
+ end_time: `2020-11-11 13:00:00` (string) - DR end time
+ volume: 50 (number) - bidding capacity
+ price: 6 (number) - bidding price
+ result: false (boolean) - bool
+ rate: 0 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0x07178bc6d022a826d7f85b64f00b77bf878d04519cfbdc6e33aacd802b191435` (string) - url
+ (BIDRESULT)
+ uuid: `ca45ecc1-13a1-4a93-b047-857be806b764` (string) - bid uuid
+ executor: `Carlab_BEMS` (string) - Name of BEMS
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 30 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ result: true (boolean) - bool
+ rate: 0.33 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0xc94ec346cea143d8aab07e3a23a9f24031a9a9ae5b9717d99cf32ac0f57a920d` (string) - url
+ Response 400 (text/plain)
+ body
error
### BEMS DR RESULTS BY UUID [GET /DR_result{?uuid}]
<pre>
curl https://et.udc-service.io:5000/DR_result?uuid=fbb4ccc5-d4ea-489d-94ea-3f04cd48b17b -X GET -H "Content-Type: application/json" -H "Authorization: Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR"
</pre>
Get DR results: By specifying uuids in query parameter, response will return same uuid result.
* When you are logged in as a BEMS, you can only query uuid within your bids, otherwise return empty.
* For Aggregator, he/she can request any uuid unless the uuid is not found in database.
+ Parameters
+ uuid: `fbb4ccc5-d4ea-489d-94ea-3f04cd48b17b` (required, string) - uuid of bid
+ Request
+ Headers
API-version: 0.1
Authorization: `Bearer OXBiogjCfdKb7m9CEOPhpbjjv0n5OtfltzgMJbSxbP7jVFY8XUNzHqkGidDumQSR
+ Response 200 (application/json)
+ Attributes (array, fixed-type)
+ (BIDRESULT)
+ Response 400 (text/plain)
+ body
error
## Data Structures
### BEMSBID
+ uuid: `fbb4ccc5-d4ea-489d-94ea-3f04cd48b17b` (string) - bid uuid
+ executor: `NCKU` (string) - Name of BEMS
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 40 (number) - bidding capacity
+ price: 8 (number) - bidding price
### BIDRESULT
+ uuid: `fbb4ccc5-d4ea-489d-94ea-3f04cd48b17b` (string) - uuid
+ executor: `NCKU` (string) - BEMS name
+ acceptor: `Carlab_BEMS` (string) - CEMS name
+ start_time: `2020-11-11 11:00:00` (string) - DR start time
+ end_time: `2020-11-11 12:00:00` (string) - DR end time
+ volume: 40 (number) - bidding capacity
+ price: 8 (number) - bidding price
+ result: true (boolean) - bool
+ rate: 0.11 (number) - 達成率
+ blockchain_url: `https://ropsten.etherscan.io/tx/0x07178bc6d022a826d7f85b64f00b77bf878d04519cfbdc6e33aacd802b191435` (string) - url