losant_rest 1.2.3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -0
  3. data/docs/_schemas.md +997 -157
  4. data/docs/dataTable.md +214 -0
  5. data/docs/dataTableRow.md +136 -0
  6. data/docs/dataTableRows.md +139 -0
  7. data/docs/dataTables.md +91 -0
  8. data/docs/flow.md +41 -1
  9. data/lib/losant_rest/client.rb +18 -2
  10. data/lib/losant_rest/data_table.rb +272 -0
  11. data/lib/losant_rest/data_table_row.rb +180 -0
  12. data/lib/losant_rest/data_table_rows.rb +192 -0
  13. data/lib/losant_rest/data_tables.rb +136 -0
  14. data/lib/losant_rest/flow.rb +47 -1
  15. data/lib/losant_rest/version.rb +1 -1
  16. data/lib/losant_rest.rb +4 -0
  17. data/schemas/application.json +3 -0
  18. data/schemas/applicationApiTokenPost.json +16 -0
  19. data/schemas/applications.json +3 -0
  20. data/schemas/auditLog.json +1 -0
  21. data/schemas/auditLogFilter.json +1 -0
  22. data/schemas/auditLogs.json +1 -0
  23. data/schemas/dataTable.json +79 -0
  24. data/schemas/dataTableColumn.json +39 -0
  25. data/schemas/dataTablePatch.json +16 -0
  26. data/schemas/dataTablePost.json +63 -0
  27. data/schemas/dataTableQuery.json +86 -0
  28. data/schemas/dataTableRow.json +28 -0
  29. data/schemas/dataTableRowInsertUpdate.json +15 -0
  30. data/schemas/dataTableRows.json +68 -0
  31. data/schemas/dataTables.json +121 -0
  32. data/schemas/flow.json +1 -0
  33. data/schemas/flowPatch.json +1 -0
  34. data/schemas/flowPost.json +1 -0
  35. data/schemas/flowVersion.json +1 -0
  36. data/schemas/flowVersionPost.json +1 -0
  37. data/schemas/flowVersions.json +1 -0
  38. data/schemas/flows.json +1 -0
  39. data/schemas/me.json +14 -0
  40. data/schemas/org.json +14 -0
  41. data/schemas/orgs.json +14 -0
  42. data/schemas/payloadCounts.json +8 -0
  43. metadata +19 -2
data/docs/_schemas.md CHANGED
@@ -23,6 +23,15 @@
23
23
  * [Dashboard Patch](#dashboard-patch)
24
24
  * [Dashboard Post](#dashboard-post)
25
25
  * [Dashboards](#dashboards)
26
+ * [Data Table](#data-table)
27
+ * [Data Table Column](#data-table-column)
28
+ * [Data Table Patch](#data-table-patch)
29
+ * [Data Table Post](#data-table-post)
30
+ * [Data Table Query](#data-table-query)
31
+ * [Data Table Row](#data-table-row)
32
+ * [Data Table Row Insert/Update](#data-table-row-insert/update)
33
+ * [Data Table Rows](#data-table-rows)
34
+ * [Data Tables](#data-tables)
26
35
  * [Device](#device)
27
36
  * [Device Command](#device-command)
28
37
  * [Device Commands](#device-commands)
@@ -364,6 +373,9 @@ Schema for a single Application
364
373
  "deviceCount": {
365
374
  "type": "number"
366
375
  },
376
+ "dataTableCount": {
377
+ "type": "number"
378
+ },
367
379
  "deviceRecipeCount": {
368
380
  "type": "number"
369
381
  },
@@ -457,6 +469,8 @@ Schema for the body of an Application API Token creation request
457
469
  "applicationKey.*",
458
470
  "applicationKeys.*",
459
471
  "data.*",
472
+ "dataTable.*",
473
+ "dataTables.*",
460
474
  "device.*",
461
475
  "deviceRecipe.*",
462
476
  "deviceRecipes.*",
@@ -493,6 +507,19 @@ Schema for the body of an Application API Token creation request
493
507
  "applicationKeys.post",
494
508
  "data.lastValueQuery",
495
509
  "data.timeSeriesQuery",
510
+ "dataTable.addColumn",
511
+ "dataTable.delete",
512
+ "dataTable.get",
513
+ "dataTable.patch",
514
+ "dataTable.removeColumn",
515
+ "dataTableRow.delete",
516
+ "dataTableRow.get",
517
+ "dataTableRow.patch",
518
+ "dataTableRows.get",
519
+ "dataTableRows.post",
520
+ "dataTableRows.query",
521
+ "dataTables.get",
522
+ "dataTables.post",
496
523
  "device.delete",
497
524
  "device.export",
498
525
  "device.get",
@@ -538,6 +565,7 @@ Schema for the body of an Application API Token creation request
538
565
  "experienceUsers.get",
539
566
  "experienceUsers.post",
540
567
  "flow.delete",
568
+ "flow.clearStorageEntries",
541
569
  "flow.get",
542
570
  "flow.getStorageEntries",
543
571
  "flow.log",
@@ -1181,6 +1209,9 @@ Schema for a collection of Applications
1181
1209
  "deviceCount": {
1182
1210
  "type": "number"
1183
1211
  },
1212
+ "dataTableCount": {
1213
+ "type": "number"
1214
+ },
1184
1215
  "deviceRecipeCount": {
1185
1216
  "type": "number"
1186
1217
  },
@@ -1329,6 +1360,7 @@ Schema for a single Audit Log entry
1329
1360
  "enum": [
1330
1361
  "ApiToken",
1331
1362
  "ApplicationKey",
1363
+ "DataTable",
1332
1364
  "Device",
1333
1365
  "DeviceRecipe",
1334
1366
  "Event",
@@ -1473,6 +1505,7 @@ Schema for the filter of an audit log query
1473
1505
  "enum": [
1474
1506
  "ApiToken",
1475
1507
  "ApplicationKey",
1508
+ "DataTable",
1476
1509
  "Device",
1477
1510
  "DeviceRecipe",
1478
1511
  "Event",
@@ -1634,6 +1667,7 @@ Schema for a collection of Audit Logs
1634
1667
  "enum": [
1635
1668
  "ApiToken",
1636
1669
  "ApplicationKey",
1670
+ "DataTable",
1637
1671
  "Device",
1638
1672
  "DeviceRecipe",
1639
1673
  "Event",
@@ -2571,29 +2605,880 @@ Schema for the body of a Dashboard creation request
2571
2605
  "additionalProperties": false
2572
2606
  }
2573
2607
  }
2574
- },
2575
- "additionalProperties": false,
2576
- "required": [
2577
- "name"
2578
- ]
2608
+ },
2609
+ "additionalProperties": false,
2610
+ "required": [
2611
+ "name"
2612
+ ]
2613
+ }
2614
+ ```
2615
+ ### <a name="dashboard-post-example"></a> Example
2616
+
2617
+ ```json
2618
+ {
2619
+ "name": "My New Dashboard",
2620
+ "public": false
2621
+ }
2622
+ ```
2623
+
2624
+ <br/>
2625
+
2626
+ ## Dashboards
2627
+
2628
+ Schema for a collection of Dashboards
2629
+
2630
+ ### <a name="dashboards-schema"></a> Schema
2631
+
2632
+ ```json
2633
+ {
2634
+ "$schema": "http://json-schema.org/draft-04/schema#",
2635
+ "type": "object",
2636
+ "properties": {
2637
+ "items": {
2638
+ "type": "array",
2639
+ "items": {
2640
+ "title": "Dashboard",
2641
+ "description": "Schema for a single Dashboard",
2642
+ "type": "object",
2643
+ "properties": {
2644
+ "id": {
2645
+ "type": "string",
2646
+ "pattern": "^[A-Fa-f\\d]{24}$"
2647
+ },
2648
+ "dashboardId": {
2649
+ "type": "string",
2650
+ "pattern": "^[A-Fa-f\\d]{24}$"
2651
+ },
2652
+ "creationDate": {
2653
+ "type": "string",
2654
+ "format": "date-time"
2655
+ },
2656
+ "lastUpdated": {
2657
+ "type": "string",
2658
+ "format": "date-time"
2659
+ },
2660
+ "ownerId": {
2661
+ "type": "string",
2662
+ "pattern": "^[A-Fa-f\\d]{24}$"
2663
+ },
2664
+ "ownerType": {
2665
+ "type": "string",
2666
+ "enum": [
2667
+ "user",
2668
+ "organization"
2669
+ ]
2670
+ },
2671
+ "name": {
2672
+ "type": "string",
2673
+ "minLength": 1,
2674
+ "maxLength": 255
2675
+ },
2676
+ "description": {
2677
+ "type": "string",
2678
+ "maxLength": 32767
2679
+ },
2680
+ "refreshRate": {
2681
+ "type": "number",
2682
+ "minimum": 5,
2683
+ "maximum": 600
2684
+ },
2685
+ "isPasswordProtected": {
2686
+ "type": "boolean"
2687
+ },
2688
+ "public": {
2689
+ "type": "boolean"
2690
+ },
2691
+ "blocks": {
2692
+ "type": "array",
2693
+ "items": {
2694
+ "type": "object",
2695
+ "properties": {
2696
+ "id": {
2697
+ "type": "string"
2698
+ },
2699
+ "blockType": {
2700
+ "type": "string"
2701
+ },
2702
+ "title": {
2703
+ "type": "string",
2704
+ "maxLength": 255
2705
+ },
2706
+ "applicationId": {
2707
+ "type": "string",
2708
+ "pattern": "^[A-Fa-f\\d]{24}$"
2709
+ },
2710
+ "startX": {
2711
+ "type": "number"
2712
+ },
2713
+ "startY": {
2714
+ "type": "number"
2715
+ },
2716
+ "width": {
2717
+ "type": "number"
2718
+ },
2719
+ "height": {
2720
+ "type": "number"
2721
+ },
2722
+ "config": {
2723
+ "type": "object"
2724
+ }
2725
+ },
2726
+ "required": [
2727
+ "blockType",
2728
+ "startX",
2729
+ "startY",
2730
+ "width",
2731
+ "height"
2732
+ ],
2733
+ "additionalProperties": false
2734
+ }
2735
+ },
2736
+ "contextConfiguration": {
2737
+ "type": "array",
2738
+ "items": {
2739
+ "type": "object",
2740
+ "properties": {
2741
+ "name": {
2742
+ "type": "string",
2743
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2744
+ },
2745
+ "type": {
2746
+ "type": "string",
2747
+ "enum": [
2748
+ "deviceId",
2749
+ "deviceAttribute",
2750
+ "string",
2751
+ "number"
2752
+ ]
2753
+ },
2754
+ "applicationId": {
2755
+ "type": "string",
2756
+ "pattern": "^[A-Fa-f\\d]{24}$"
2757
+ },
2758
+ "defaultValue": {
2759
+ "type": [
2760
+ "string",
2761
+ "number"
2762
+ ]
2763
+ },
2764
+ "validationEnabled": {
2765
+ "type": "boolean"
2766
+ },
2767
+ "validationConfig": {
2768
+ "type": "object",
2769
+ "properties": {
2770
+ "min": {
2771
+ "type": "number"
2772
+ },
2773
+ "max": {
2774
+ "type": "number"
2775
+ },
2776
+ "regExp": {
2777
+ "type": "string",
2778
+ "maxLength": 1024
2779
+ },
2780
+ "attributes": {
2781
+ "type": "array",
2782
+ "items": {
2783
+ "type": "string",
2784
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2785
+ }
2786
+ },
2787
+ "deviceIds": {
2788
+ "type": "array",
2789
+ "items": {
2790
+ "type": "string",
2791
+ "pattern": "^[A-Fa-f\\d]{24}$"
2792
+ },
2793
+ "maxItems": 1000
2794
+ },
2795
+ "deviceTags": {
2796
+ "type": "array",
2797
+ "items": {
2798
+ "type": "object",
2799
+ "properties": {
2800
+ "key": {
2801
+ "type": "string",
2802
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2803
+ },
2804
+ "value": {
2805
+ "type": "string",
2806
+ "minLength": 1,
2807
+ "maxLength": 255
2808
+ }
2809
+ },
2810
+ "additionalProperties": false
2811
+ },
2812
+ "maxItems": 100
2813
+ }
2814
+ },
2815
+ "additionalProperties": false
2816
+ }
2817
+ },
2818
+ "required": [
2819
+ "name",
2820
+ "type",
2821
+ "defaultValue"
2822
+ ],
2823
+ "additionalProperties": false
2824
+ }
2825
+ }
2826
+ }
2827
+ }
2828
+ },
2829
+ "count": {
2830
+ "type": "integer"
2831
+ },
2832
+ "totalCount": {
2833
+ "type": "integer"
2834
+ },
2835
+ "perPage": {
2836
+ "type": "integer"
2837
+ },
2838
+ "page": {
2839
+ "type": "integer"
2840
+ },
2841
+ "filter": {
2842
+ "type": "string"
2843
+ },
2844
+ "filterField": {
2845
+ "type": "string"
2846
+ },
2847
+ "sortField": {
2848
+ "type": "string"
2849
+ },
2850
+ "sortDirection": {
2851
+ "type": "string",
2852
+ "enum": [
2853
+ "asc",
2854
+ "desc"
2855
+ ]
2856
+ }
2857
+ }
2858
+ }
2859
+ ```
2860
+ ### <a name="dashboards-example"></a> Example
2861
+
2862
+ ```json
2863
+ {
2864
+ "items": [
2865
+ {
2866
+ "id": "575ece2b7ae143cd83dc4a9b",
2867
+ "dashboardId": "575ece2b7ae143cd83dc4a9b",
2868
+ "creationDate": "2016-06-13T04:00:00.000Z",
2869
+ "lastUpdated": "2016-06-13T04:00:00.000Z",
2870
+ "ownerId": "575ed70c7ae143cd83dc4aa9",
2871
+ "ownerType": "user",
2872
+ "name": "My Dashboard",
2873
+ "description": "The best dashboard description",
2874
+ "refreshRate": 60,
2875
+ "public": false,
2876
+ "blocks": []
2877
+ }
2878
+ ],
2879
+ "count": 1,
2880
+ "totalCount": 5,
2881
+ "perPage": 1,
2882
+ "page": 0,
2883
+ "sortField": "name",
2884
+ "sortDirection": "asc"
2885
+ }
2886
+ ```
2887
+
2888
+ <br/>
2889
+
2890
+ ## Data Table
2891
+
2892
+ Schema for a single Data Table
2893
+
2894
+ ### <a name="data-table-schema"></a> Schema
2895
+
2896
+ ```json
2897
+ {
2898
+ "$schema": "http://json-schema.org/draft-04/schema#",
2899
+ "type": "object",
2900
+ "properties": {
2901
+ "id": {
2902
+ "type": "string",
2903
+ "pattern": "^[A-Fa-f\\d]{24}$"
2904
+ },
2905
+ "dataTableId": {
2906
+ "type": "string",
2907
+ "pattern": "^[A-Fa-f\\d]{24}$"
2908
+ },
2909
+ "applicationId": {
2910
+ "type": "string",
2911
+ "pattern": "^[A-Fa-f\\d]{24}$"
2912
+ },
2913
+ "creationDate": {
2914
+ "type": "string",
2915
+ "format": "date-time"
2916
+ },
2917
+ "lastUpdated": {
2918
+ "type": "string",
2919
+ "format": "date-time"
2920
+ },
2921
+ "name": {
2922
+ "type": "string",
2923
+ "minLength": 1,
2924
+ "maxLength": 255
2925
+ },
2926
+ "description": {
2927
+ "type": "string",
2928
+ "maxLength": 32767
2929
+ },
2930
+ "columns": {
2931
+ "type": "array",
2932
+ "items": {
2933
+ "title": "Data Table Column",
2934
+ "description": "Schema for a single Data Table Column",
2935
+ "type": "object",
2936
+ "properties": {
2937
+ "name": {
2938
+ "type": "string",
2939
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2940
+ },
2941
+ "dataType": {
2942
+ "type": "string",
2943
+ "enum": [
2944
+ "string",
2945
+ "number",
2946
+ "boolean"
2947
+ ]
2948
+ },
2949
+ "constraint": {
2950
+ "type": "string",
2951
+ "enum": [
2952
+ "unique",
2953
+ "required",
2954
+ "optional"
2955
+ ]
2956
+ },
2957
+ "defaultValue": {
2958
+ "type": [
2959
+ "string",
2960
+ "number",
2961
+ "boolean"
2962
+ ]
2963
+ }
2964
+ },
2965
+ "required": [
2966
+ "name",
2967
+ "dataType",
2968
+ "constraint"
2969
+ ],
2970
+ "additionalProperties": false
2971
+ },
2972
+ "maxItems": 50
2973
+ }
2974
+ }
2975
+ }
2976
+ ```
2977
+ ### <a name="data-table-example"></a> Example
2978
+
2979
+ ```json
2980
+ {
2981
+ "id": "596e6ce831761df4231708f1",
2982
+ "dataTableId": "596e6ce831761df4231708f1",
2983
+ "applicationId": "575ec8687ae143cd83dc4a97",
2984
+ "creationDate": "2016-06-13T04:00:00.000Z",
2985
+ "lastUpdated": "2016-06-13T04:00:00.000Z",
2986
+ "name": "My Data Table",
2987
+ "columns": [
2988
+ {
2989
+ "name": "myColumn1",
2990
+ "dataType": "string",
2991
+ "defaultValue": "aDefault"
2992
+ }
2993
+ ]
2994
+ }
2995
+ ```
2996
+
2997
+ <br/>
2998
+
2999
+ ## Data Table Column
3000
+
3001
+ Schema for a single Data Table Column
3002
+
3003
+ ### <a name="data-table-column-schema"></a> Schema
3004
+
3005
+ ```json
3006
+ {
3007
+ "$schema": "http://json-schema.org/draft-04/schema#",
3008
+ "type": "object",
3009
+ "properties": {
3010
+ "name": {
3011
+ "type": "string",
3012
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
3013
+ },
3014
+ "dataType": {
3015
+ "type": "string",
3016
+ "enum": [
3017
+ "string",
3018
+ "number",
3019
+ "boolean"
3020
+ ]
3021
+ },
3022
+ "constraint": {
3023
+ "type": "string",
3024
+ "enum": [
3025
+ "unique",
3026
+ "required",
3027
+ "optional"
3028
+ ]
3029
+ },
3030
+ "defaultValue": {
3031
+ "type": [
3032
+ "string",
3033
+ "number",
3034
+ "boolean"
3035
+ ]
3036
+ }
3037
+ },
3038
+ "required": [
3039
+ "name",
3040
+ "dataType",
3041
+ "constraint"
3042
+ ],
3043
+ "additionalProperties": false
3044
+ }
3045
+ ```
3046
+ ### <a name="data-table-column-example"></a> Example
3047
+
3048
+ ```json
3049
+ {
3050
+ "name": "myOptionalColumn",
3051
+ "dataType": "string",
3052
+ "constraint": "optional",
3053
+ "defaultValue": "aDefault"
3054
+ }
3055
+ ```
3056
+
3057
+ <br/>
3058
+
3059
+ ## Data Table Patch
3060
+
3061
+ Schema for the body of a Data Table modification request
3062
+
3063
+ ### <a name="data-table-patch-schema"></a> Schema
3064
+
3065
+ ```json
3066
+ {
3067
+ "$schema": "http://json-schema.org/draft-04/schema#",
3068
+ "type": "object",
3069
+ "properties": {
3070
+ "name": {
3071
+ "type": "string",
3072
+ "minLength": 1,
3073
+ "maxLength": 255
3074
+ },
3075
+ "description": {
3076
+ "type": "string",
3077
+ "maxLength": 32767
3078
+ }
3079
+ },
3080
+ "additionalProperties": false
3081
+ }
3082
+ ```
3083
+ ### <a name="data-table-patch-example"></a> Example
3084
+
3085
+ ```json
3086
+ {
3087
+ "name": "My Updated Data Table"
3088
+ }
3089
+ ```
3090
+
3091
+ <br/>
3092
+
3093
+ ## Data Table Post
3094
+
3095
+ Schema for the body of a Data Table creation request
3096
+
3097
+ ### <a name="data-table-post-schema"></a> Schema
3098
+
3099
+ ```json
3100
+ {
3101
+ "$schema": "http://json-schema.org/draft-04/schema#",
3102
+ "type": "object",
3103
+ "properties": {
3104
+ "name": {
3105
+ "type": "string",
3106
+ "minLength": 1,
3107
+ "maxLength": 255
3108
+ },
3109
+ "description": {
3110
+ "type": "string",
3111
+ "maxLength": 32767
3112
+ },
3113
+ "columns": {
3114
+ "type": "array",
3115
+ "items": {
3116
+ "title": "Data Table Column",
3117
+ "description": "Schema for a single Data Table Column",
3118
+ "type": "object",
3119
+ "properties": {
3120
+ "name": {
3121
+ "type": "string",
3122
+ "pattern": "^[0-9a-zA-Z_-]{1,255}$"
3123
+ },
3124
+ "dataType": {
3125
+ "type": "string",
3126
+ "enum": [
3127
+ "string",
3128
+ "number",
3129
+ "boolean"
3130
+ ]
3131
+ },
3132
+ "constraint": {
3133
+ "type": "string",
3134
+ "enum": [
3135
+ "unique",
3136
+ "required",
3137
+ "optional"
3138
+ ]
3139
+ },
3140
+ "defaultValue": {
3141
+ "type": [
3142
+ "string",
3143
+ "number",
3144
+ "boolean"
3145
+ ]
3146
+ }
3147
+ },
3148
+ "required": [
3149
+ "name",
3150
+ "dataType",
3151
+ "constraint"
3152
+ ],
3153
+ "additionalProperties": false
3154
+ },
3155
+ "maxItems": 50
3156
+ }
3157
+ },
3158
+ "required": [
3159
+ "name"
3160
+ ],
3161
+ "additionalProperties": false
3162
+ }
3163
+ ```
3164
+ ### <a name="data-table-post-example"></a> Example
3165
+
3166
+ ```json
3167
+ {
3168
+ "name": "My Data Table",
3169
+ "columns": [
3170
+ {
3171
+ "name": "myColumn1",
3172
+ "dataType": "string",
3173
+ "constraint": "unique"
3174
+ }
3175
+ ]
3176
+ }
3177
+ ```
3178
+
3179
+ <br/>
3180
+
3181
+ ## Data Table Query
3182
+
3183
+ Schema for a data table query
3184
+
3185
+ ### <a name="data-table-query-schema"></a> Schema
3186
+
3187
+ ```json
3188
+ {
3189
+ "$schema": "http://json-schema.org/draft-04/schema#",
3190
+ "type": "object",
3191
+ "properties": {
3192
+ "$and": {
3193
+ "type": "array",
3194
+ "items": {
3195
+ "$ref": "#/definitions/dataTableQuery"
3196
+ }
3197
+ },
3198
+ "$or": {
3199
+ "type": "array",
3200
+ "items": {
3201
+ "$ref": "#/definitions/dataTableQuery"
3202
+ }
3203
+ }
3204
+ },
3205
+ "patternProperties": {
3206
+ "^[0-9a-zA-Z_-]{1,255}$": {
3207
+ "oneOf": [
3208
+ {
3209
+ "type": [
3210
+ "string",
3211
+ "number",
3212
+ "boolean",
3213
+ "null"
3214
+ ]
3215
+ },
3216
+ {
3217
+ "type": "object",
3218
+ "properties": {
3219
+ "$eq": {
3220
+ "type": [
3221
+ "string",
3222
+ "number",
3223
+ "boolean",
3224
+ "null"
3225
+ ]
3226
+ },
3227
+ "$ne": {
3228
+ "type": [
3229
+ "string",
3230
+ "number",
3231
+ "boolean",
3232
+ "null"
3233
+ ]
3234
+ },
3235
+ "$gt": {
3236
+ "type": [
3237
+ "string",
3238
+ "number",
3239
+ "boolean",
3240
+ "null"
3241
+ ]
3242
+ },
3243
+ "$lt": {
3244
+ "type": [
3245
+ "string",
3246
+ "number",
3247
+ "boolean",
3248
+ "null"
3249
+ ]
3250
+ },
3251
+ "$gte": {
3252
+ "type": [
3253
+ "string",
3254
+ "number",
3255
+ "boolean",
3256
+ "null"
3257
+ ]
3258
+ },
3259
+ "$lte": {
3260
+ "type": [
3261
+ "string",
3262
+ "number",
3263
+ "boolean",
3264
+ "null"
3265
+ ]
3266
+ }
3267
+ }
3268
+ }
3269
+ ]
3270
+ }
3271
+ },
3272
+ "additionalProperties": false
3273
+ }
3274
+ ```
3275
+ ### <a name="data-table-query-example"></a> Example
3276
+
3277
+ ```json
3278
+ {
3279
+ "$or": [
3280
+ {
3281
+ "myCol1": {
3282
+ "$ne": 0
3283
+ }
3284
+ },
3285
+ {
3286
+ "myCol2": 5
3287
+ }
3288
+ ]
3289
+ }
3290
+ ```
3291
+
3292
+ <br/>
3293
+
3294
+ ## Data Table Row
3295
+
3296
+ Schema for a single Data Table Row
3297
+
3298
+ ### <a name="data-table-row-schema"></a> Schema
3299
+
3300
+ ```json
3301
+ {
3302
+ "$schema": "http://json-schema.org/draft-04/schema#",
3303
+ "type": "object",
3304
+ "properties": {
3305
+ "id": {
3306
+ "type": "string",
3307
+ "pattern": "^[A-Fa-f\\d]{24}$"
3308
+ },
3309
+ "createdAt": {
3310
+ "type": "string",
3311
+ "format": "date-time"
3312
+ },
3313
+ "updatedAt": {
3314
+ "type": "string",
3315
+ "format": "date-time"
3316
+ }
3317
+ },
3318
+ "patternProperties": {
3319
+ "^[0-9a-zA-Z_-]{1,255}$": {
3320
+ "type": [
3321
+ "string",
3322
+ "number",
3323
+ "boolean",
3324
+ "null"
3325
+ ]
3326
+ }
3327
+ }
3328
+ }
3329
+ ```
3330
+ ### <a name="data-table-row-example"></a> Example
3331
+
3332
+ ```json
3333
+ {
3334
+ "id": "596fbb703fc088453872e609",
3335
+ "creationDate": "2016-06-13T04:00:00.000Z",
3336
+ "lastUpdated": "2016-06-13T04:00:00.000Z",
3337
+ "myColumn": "myValue"
3338
+ }
3339
+ ```
3340
+
3341
+ <br/>
3342
+
3343
+ ## Data Table Row Insert/Update
3344
+
3345
+ Schema for inserting or updating a data table row
3346
+
3347
+ ### <a name="data-table-row-insert/update-schema"></a> Schema
3348
+
3349
+ ```json
3350
+ {
3351
+ "$schema": "http://json-schema.org/draft-04/schema#",
3352
+ "type": "object",
3353
+ "patternProperties": {
3354
+ "^[0-9a-zA-Z_-]{1,255}$": {
3355
+ "type": [
3356
+ "string",
3357
+ "number",
3358
+ "boolean",
3359
+ "null"
3360
+ ]
3361
+ }
3362
+ },
3363
+ "additionalProperties": false
3364
+ }
3365
+ ```
3366
+ ### <a name="data-table-row-insert/update-example"></a> Example
3367
+
3368
+ ```json
3369
+ {
3370
+ "myColumn1": "myValue"
3371
+ }
3372
+ ```
3373
+
3374
+ <br/>
3375
+
3376
+ ## Data Table Rows
3377
+
3378
+ Schema for a collection of Data Table Rows
3379
+
3380
+ ### <a name="data-table-rows-schema"></a> Schema
3381
+
3382
+ ```json
3383
+ {
3384
+ "$schema": "http://json-schema.org/draft-04/schema#",
3385
+ "type": "object",
3386
+ "properties": {
3387
+ "items": {
3388
+ "type": "array",
3389
+ "items": {
3390
+ "title": "Data Table Row",
3391
+ "description": "Schema for a single Data Table Row",
3392
+ "type": "object",
3393
+ "properties": {
3394
+ "id": {
3395
+ "type": "string",
3396
+ "pattern": "^[A-Fa-f\\d]{24}$"
3397
+ },
3398
+ "createdAt": {
3399
+ "type": "string",
3400
+ "format": "date-time"
3401
+ },
3402
+ "updatedAt": {
3403
+ "type": "string",
3404
+ "format": "date-time"
3405
+ }
3406
+ },
3407
+ "patternProperties": {
3408
+ "^[0-9a-zA-Z_-]{1,255}$": {
3409
+ "type": [
3410
+ "string",
3411
+ "number",
3412
+ "boolean",
3413
+ "null"
3414
+ ]
3415
+ }
3416
+ }
3417
+ }
3418
+ },
3419
+ "count": {
3420
+ "type": "integer"
3421
+ },
3422
+ "totalCount": {
3423
+ "type": "integer"
3424
+ },
3425
+ "limit": {
3426
+ "type": "integer"
3427
+ },
3428
+ "offset": {
3429
+ "type": "integer"
3430
+ },
3431
+ "sortColumn": {
3432
+ "type": "string"
3433
+ },
3434
+ "sortDirection": {
3435
+ "type": "string",
3436
+ "enum": [
3437
+ "asc",
3438
+ "desc"
3439
+ ]
3440
+ },
3441
+ "dataTableId": {
3442
+ "type": "string",
3443
+ "pattern": "^[A-Fa-f\\d]{24}$"
3444
+ },
3445
+ "applicationId": {
3446
+ "type": "string",
3447
+ "pattern": "^[A-Fa-f\\d]{24}$"
3448
+ }
3449
+ }
2579
3450
  }
2580
3451
  ```
2581
- ### <a name="dashboard-post-example"></a> Example
3452
+ ### <a name="data-table-rows-example"></a> Example
2582
3453
 
2583
3454
  ```json
2584
3455
  {
2585
- "name": "My New Dashboard",
2586
- "public": false
3456
+ "items": [
3457
+ {
3458
+ "id": "596fbb703fc088453872e609",
3459
+ "creationDate": "2016-06-13T04:00:00.000Z",
3460
+ "lastUpdated": "2016-06-13T04:00:00.000Z",
3461
+ "myColumn": "myValue"
3462
+ }
3463
+ ],
3464
+ "count": 1,
3465
+ "totalCount": 4,
3466
+ "offset": 0,
3467
+ "limit": 1,
3468
+ "sortColumn": "myColumn1",
3469
+ "sortDirection": "asc",
3470
+ "dataTableId": "596e6ce831761df4231708f1",
3471
+ "applicationId": "575ec8687ae143cd83dc4a97"
2587
3472
  }
2588
3473
  ```
2589
3474
 
2590
3475
  <br/>
2591
3476
 
2592
- ## Dashboards
3477
+ ## Data Tables
2593
3478
 
2594
- Schema for a collection of Dashboards
3479
+ Schema for a collection of Data Tables
2595
3480
 
2596
- ### <a name="dashboards-schema"></a> Schema
3481
+ ### <a name="data-tables-schema"></a> Schema
2597
3482
 
2598
3483
  ```json
2599
3484
  {
@@ -2603,15 +3488,19 @@ Schema for a collection of Dashboards
2603
3488
  "items": {
2604
3489
  "type": "array",
2605
3490
  "items": {
2606
- "title": "Dashboard",
2607
- "description": "Schema for a single Dashboard",
3491
+ "title": "Data Table",
3492
+ "description": "Schema for a single Data Table",
2608
3493
  "type": "object",
2609
3494
  "properties": {
2610
3495
  "id": {
2611
3496
  "type": "string",
2612
3497
  "pattern": "^[A-Fa-f\\d]{24}$"
2613
3498
  },
2614
- "dashboardId": {
3499
+ "dataTableId": {
3500
+ "type": "string",
3501
+ "pattern": "^[A-Fa-f\\d]{24}$"
3502
+ },
3503
+ "applicationId": {
2615
3504
  "type": "string",
2616
3505
  "pattern": "^[A-Fa-f\\d]{24}$"
2617
3506
  },
@@ -2623,17 +3512,6 @@ Schema for a collection of Dashboards
2623
3512
  "type": "string",
2624
3513
  "format": "date-time"
2625
3514
  },
2626
- "ownerId": {
2627
- "type": "string",
2628
- "pattern": "^[A-Fa-f\\d]{24}$"
2629
- },
2630
- "ownerType": {
2631
- "type": "string",
2632
- "enum": [
2633
- "user",
2634
- "organization"
2635
- ]
2636
- },
2637
3515
  "name": {
2638
3516
  "type": "string",
2639
3517
  "minLength": 1,
@@ -2643,151 +3521,49 @@ Schema for a collection of Dashboards
2643
3521
  "type": "string",
2644
3522
  "maxLength": 32767
2645
3523
  },
2646
- "refreshRate": {
2647
- "type": "number",
2648
- "minimum": 5,
2649
- "maximum": 600
2650
- },
2651
- "isPasswordProtected": {
2652
- "type": "boolean"
2653
- },
2654
- "public": {
2655
- "type": "boolean"
2656
- },
2657
- "blocks": {
2658
- "type": "array",
2659
- "items": {
2660
- "type": "object",
2661
- "properties": {
2662
- "id": {
2663
- "type": "string"
2664
- },
2665
- "blockType": {
2666
- "type": "string"
2667
- },
2668
- "title": {
2669
- "type": "string",
2670
- "maxLength": 255
2671
- },
2672
- "applicationId": {
2673
- "type": "string",
2674
- "pattern": "^[A-Fa-f\\d]{24}$"
2675
- },
2676
- "startX": {
2677
- "type": "number"
2678
- },
2679
- "startY": {
2680
- "type": "number"
2681
- },
2682
- "width": {
2683
- "type": "number"
2684
- },
2685
- "height": {
2686
- "type": "number"
2687
- },
2688
- "config": {
2689
- "type": "object"
2690
- }
2691
- },
2692
- "required": [
2693
- "blockType",
2694
- "startX",
2695
- "startY",
2696
- "width",
2697
- "height"
2698
- ],
2699
- "additionalProperties": false
2700
- }
2701
- },
2702
- "contextConfiguration": {
3524
+ "columns": {
2703
3525
  "type": "array",
2704
3526
  "items": {
3527
+ "title": "Data Table Column",
3528
+ "description": "Schema for a single Data Table Column",
2705
3529
  "type": "object",
2706
3530
  "properties": {
2707
3531
  "name": {
2708
3532
  "type": "string",
2709
3533
  "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2710
3534
  },
2711
- "type": {
3535
+ "dataType": {
2712
3536
  "type": "string",
2713
3537
  "enum": [
2714
- "deviceId",
2715
- "deviceAttribute",
2716
3538
  "string",
2717
- "number"
3539
+ "number",
3540
+ "boolean"
2718
3541
  ]
2719
3542
  },
2720
- "applicationId": {
3543
+ "constraint": {
2721
3544
  "type": "string",
2722
- "pattern": "^[A-Fa-f\\d]{24}$"
3545
+ "enum": [
3546
+ "unique",
3547
+ "required",
3548
+ "optional"
3549
+ ]
2723
3550
  },
2724
3551
  "defaultValue": {
2725
3552
  "type": [
2726
3553
  "string",
2727
- "number"
3554
+ "number",
3555
+ "boolean"
2728
3556
  ]
2729
- },
2730
- "validationEnabled": {
2731
- "type": "boolean"
2732
- },
2733
- "validationConfig": {
2734
- "type": "object",
2735
- "properties": {
2736
- "min": {
2737
- "type": "number"
2738
- },
2739
- "max": {
2740
- "type": "number"
2741
- },
2742
- "regExp": {
2743
- "type": "string",
2744
- "maxLength": 1024
2745
- },
2746
- "attributes": {
2747
- "type": "array",
2748
- "items": {
2749
- "type": "string",
2750
- "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2751
- }
2752
- },
2753
- "deviceIds": {
2754
- "type": "array",
2755
- "items": {
2756
- "type": "string",
2757
- "pattern": "^[A-Fa-f\\d]{24}$"
2758
- },
2759
- "maxItems": 1000
2760
- },
2761
- "deviceTags": {
2762
- "type": "array",
2763
- "items": {
2764
- "type": "object",
2765
- "properties": {
2766
- "key": {
2767
- "type": "string",
2768
- "pattern": "^[0-9a-zA-Z_-]{1,255}$"
2769
- },
2770
- "value": {
2771
- "type": "string",
2772
- "minLength": 1,
2773
- "maxLength": 255
2774
- }
2775
- },
2776
- "additionalProperties": false
2777
- },
2778
- "maxItems": 100
2779
- }
2780
- },
2781
- "additionalProperties": false
2782
3557
  }
2783
3558
  },
2784
3559
  "required": [
2785
3560
  "name",
2786
- "type",
2787
- "defaultValue"
3561
+ "dataType",
3562
+ "constraint"
2788
3563
  ],
2789
3564
  "additionalProperties": false
2790
- }
3565
+ },
3566
+ "maxItems": 50
2791
3567
  }
2792
3568
  }
2793
3569
  }
@@ -2819,35 +3595,42 @@ Schema for a collection of Dashboards
2819
3595
  "asc",
2820
3596
  "desc"
2821
3597
  ]
3598
+ },
3599
+ "applicationId": {
3600
+ "type": "string",
3601
+ "pattern": "^[A-Fa-f\\d]{24}$"
2822
3602
  }
2823
3603
  }
2824
3604
  }
2825
3605
  ```
2826
- ### <a name="dashboards-example"></a> Example
3606
+ ### <a name="data-tables-example"></a> Example
2827
3607
 
2828
3608
  ```json
2829
3609
  {
2830
3610
  "items": [
2831
3611
  {
2832
- "id": "575ece2b7ae143cd83dc4a9b",
2833
- "dashboardId": "575ece2b7ae143cd83dc4a9b",
3612
+ "id": "596e6ce831761df4231708f1",
3613
+ "dataTableId": "596e6ce831761df4231708f1",
3614
+ "applicationId": "575ec8687ae143cd83dc4a97",
2834
3615
  "creationDate": "2016-06-13T04:00:00.000Z",
2835
3616
  "lastUpdated": "2016-06-13T04:00:00.000Z",
2836
- "ownerId": "575ed70c7ae143cd83dc4aa9",
2837
- "ownerType": "user",
2838
- "name": "My Dashboard",
2839
- "description": "The best dashboard description",
2840
- "refreshRate": 60,
2841
- "public": false,
2842
- "blocks": []
3617
+ "name": "My Data Table",
3618
+ "columns": [
3619
+ {
3620
+ "name": "myColumn1",
3621
+ "dataType": "string",
3622
+ "defaultValue": "aDefault"
3623
+ }
3624
+ ]
2843
3625
  }
2844
3626
  ],
2845
3627
  "count": 1,
2846
- "totalCount": 5,
3628
+ "totalCount": 4,
2847
3629
  "perPage": 1,
2848
3630
  "page": 0,
2849
3631
  "sortField": "name",
2850
- "sortDirection": "asc"
3632
+ "sortDirection": "asc",
3633
+ "applicationId": "575ec8687ae143cd83dc4a97"
2851
3634
  }
2852
3635
  ```
2853
3636
 
@@ -6424,6 +7207,7 @@ Schema for a single Workflow
6424
7207
  "type": {
6425
7208
  "type": "string",
6426
7209
  "enum": [
7210
+ "dataTable",
6427
7211
  "deviceId",
6428
7212
  "deviceIdConnect",
6429
7213
  "deviceIdDisconnect",
@@ -6705,6 +7489,7 @@ Schema for the body of a Workflow modification request
6705
7489
  "type": {
6706
7490
  "type": "string",
6707
7491
  "enum": [
7492
+ "dataTable",
6708
7493
  "deviceId",
6709
7494
  "deviceIdConnect",
6710
7495
  "deviceIdDisconnect",
@@ -6858,6 +7643,7 @@ Schema for the body of a Workflow creation request
6858
7643
  "type": {
6859
7644
  "type": "string",
6860
7645
  "enum": [
7646
+ "dataTable",
6861
7647
  "deviceId",
6862
7648
  "deviceIdConnect",
6863
7649
  "deviceIdDisconnect",
@@ -7142,6 +7928,7 @@ Schema for a single Workflow Version
7142
7928
  "type": {
7143
7929
  "type": "string",
7144
7930
  "enum": [
7931
+ "dataTable",
7145
7932
  "deviceId",
7146
7933
  "deviceIdConnect",
7147
7934
  "deviceIdDisconnect",
@@ -7336,6 +8123,7 @@ Schema for the body of a Workflow Version creation request
7336
8123
  "type": {
7337
8124
  "type": "string",
7338
8125
  "enum": [
8126
+ "dataTable",
7339
8127
  "deviceId",
7340
8128
  "deviceIdConnect",
7341
8129
  "deviceIdDisconnect",
@@ -7523,6 +8311,7 @@ Schema for a collection of Workflow Versions
7523
8311
  "type": {
7524
8312
  "type": "string",
7525
8313
  "enum": [
8314
+ "dataTable",
7526
8315
  "deviceId",
7527
8316
  "deviceIdConnect",
7528
8317
  "deviceIdDisconnect",
@@ -7766,6 +8555,7 @@ Schema for a collection of Workflows
7766
8555
  "type": {
7767
8556
  "type": "string",
7768
8557
  "enum": [
8558
+ "dataTable",
7769
8559
  "deviceId",
7770
8560
  "deviceIdConnect",
7771
8561
  "deviceIdDisconnect",
@@ -9076,6 +9866,9 @@ Schema for information about the currently authenticated user
9076
9866
  "dashboard": {
9077
9867
  "type": "number"
9078
9868
  },
9869
+ "datatable": {
9870
+ "type": "number"
9871
+ },
9079
9872
  "device": {
9080
9873
  "type": "number"
9081
9874
  },
@@ -9236,6 +10029,9 @@ Schema for information about the currently authenticated user
9236
10029
  "dashCount": {
9237
10030
  "type": "number"
9238
10031
  },
10032
+ "dataTableCount": {
10033
+ "type": "number"
10034
+ },
9239
10035
  "deviceCount": {
9240
10036
  "type": "number"
9241
10037
  },
@@ -9278,6 +10074,14 @@ Schema for information about the currently authenticated user
9278
10074
  }
9279
10075
  }
9280
10076
  },
10077
+ "dataTable": {
10078
+ "type": "object",
10079
+ "patternProperties": {
10080
+ ".*": {
10081
+ "type": "number"
10082
+ }
10083
+ }
10084
+ },
9281
10085
  "deviceState": {
9282
10086
  "type": "object",
9283
10087
  "patternProperties": {
@@ -9669,6 +10473,9 @@ Schema for a single Organization
9669
10473
  "dashboard": {
9670
10474
  "type": "number"
9671
10475
  },
10476
+ "datatable": {
10477
+ "type": "number"
10478
+ },
9672
10479
  "device": {
9673
10480
  "type": "number"
9674
10481
  },
@@ -9721,6 +10528,9 @@ Schema for a single Organization
9721
10528
  "dashCount": {
9722
10529
  "type": "number"
9723
10530
  },
10531
+ "dataTableCount": {
10532
+ "type": "number"
10533
+ },
9724
10534
  "deviceCount": {
9725
10535
  "type": "number"
9726
10536
  },
@@ -9766,6 +10576,14 @@ Schema for a single Organization
9766
10576
  }
9767
10577
  }
9768
10578
  },
10579
+ "dataTable": {
10580
+ "type": "object",
10581
+ "patternProperties": {
10582
+ ".*": {
10583
+ "type": "number"
10584
+ }
10585
+ }
10586
+ },
9769
10587
  "deviceState": {
9770
10588
  "type": "object",
9771
10589
  "patternProperties": {
@@ -10414,6 +11232,9 @@ Schema for a collection of Organizations
10414
11232
  "dashboard": {
10415
11233
  "type": "number"
10416
11234
  },
11235
+ "datatable": {
11236
+ "type": "number"
11237
+ },
10417
11238
  "device": {
10418
11239
  "type": "number"
10419
11240
  },
@@ -10466,6 +11287,9 @@ Schema for a collection of Organizations
10466
11287
  "dashCount": {
10467
11288
  "type": "number"
10468
11289
  },
11290
+ "dataTableCount": {
11291
+ "type": "number"
11292
+ },
10469
11293
  "deviceCount": {
10470
11294
  "type": "number"
10471
11295
  },
@@ -10511,6 +11335,14 @@ Schema for a collection of Organizations
10511
11335
  }
10512
11336
  }
10513
11337
  },
11338
+ "dataTable": {
11339
+ "type": "object",
11340
+ "patternProperties": {
11341
+ ".*": {
11342
+ "type": "number"
11343
+ }
11344
+ }
11345
+ },
10514
11346
  "deviceState": {
10515
11347
  "type": "object",
10516
11348
  "patternProperties": {
@@ -10749,6 +11581,14 @@ Schema for the result of a payload count request
10749
11581
  }
10750
11582
  }
10751
11583
  },
11584
+ "dataTable": {
11585
+ "type": "object",
11586
+ "patternProperties": {
11587
+ ".*": {
11588
+ "type": "number"
11589
+ }
11590
+ }
11591
+ },
10752
11592
  "deviceState": {
10753
11593
  "type": "object",
10754
11594
  "patternProperties": {