chirpstack_api 4.17.0

ChirpStack Protobuf / gRPC API definitions.
Documentation
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
syntax = "proto3";

package api;

option go_package = "github.com/chirpstack/chirpstack/api/go/v4/api";
option java_package = "io.chirpstack.api";
option java_multiple_files = true;
option java_outer_classname = "GatewayProto";
option csharp_namespace = "Chirpstack.Api";
option php_namespace = "Chirpstack\\Api";
option php_metadata_namespace = "GPBMetadata\\Chirpstack\\Api";

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "common/common.proto";

// GatewayService is the service providing API methods for managing gateways.
service GatewayService {
    // Create creates the given gateway.
    rpc Create(CreateGatewayRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            post: "/api/gateways"
            body: "*"
        };
    }

    // Get returns the gateway for the given Gateway ID.
    rpc Get(GetGatewayRequest) returns (GetGatewayResponse) {
        option(google.api.http) = {
            get: "/api/gateways/{gateway_id}"
        };
    }

    // Update updates the given gateway.
    rpc Update(UpdateGatewayRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            put: "/api/gateways/{gateway.gateway_id}"
            body: "*"
        };
    }

    // Delete deletes the gateway matching the given Gateway ID.
    rpc Delete(DeleteGatewayRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            delete: "/api/gateways/{gateway_id}"
        };
    }

    // Get the list of gateways.
    rpc List(ListGatewaysRequest) returns (ListGatewaysResponse) {
        option(google.api.http) = {
            get: "/api/gateways"
        };
    }

    // Generate client-certificate for the gateway.
    rpc GenerateClientCertificate(GenerateGatewayClientCertificateRequest) returns (GenerateGatewayClientCertificateResponse) {
        option(google.api.http) = {
            post: "/api/gateways/{gateway_id}/generate-certificate"
        };
    }

    // GetMetrics returns the gateway metrics.
    rpc GetMetrics(GetGatewayMetricsRequest) returns (GetGatewayMetricsResponse) {
        option(google.api.http) = {
            get: "/api/gateways/{gateway_id}/metrics"
        };
    }

    // GetDutyCycleMetrics returns the duty-cycle metrics.
    // Note that only the last 2 hours of data are stored. Currently only per minute aggregation is available.
    rpc GetDutyCycleMetrics(GetGatewayDutyCycleMetricsRequest) returns (GetGatewayDutyCycleMetricsResponse) {
        option(google.api.http) = {
            get: "/api/gateways/{gateway_id}/duty-cycle-metrics"
        };
    }

    // Get the given Relay Gateway.
    rpc GetRelayGateway(GetRelayGatewayRequest) returns (GetRelayGatewayResponse) {
        option(google.api.http) = {
            get: "/api/gateways/relay-gateways/{tenant_id}/{relay_id}"
        };
    }

    // List the detected Relay Gateways.
    rpc ListRelayGateways(ListRelayGatewaysRequest) returns (ListRelayGatewaysResponse) {
        option(google.api.http) = {
            get: "/api/gateways/relay-gateways"
        };
    }

    // Update the given Relay Gateway.
    rpc UpdateRelayGateway(UpdateRelayGatewayRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            put: "/api/gateways/relay-gateways/{relay_gateway.tenant_id}/{relay_gateway.relay_id}"
            body: "*"
        };
    }

    // Delete the given Relay Gateway.
    rpc DeleteRelayGateway(DeleteRelayGatewayRequest) returns (google.protobuf.Empty) {
        option(google.api.http) = {
            delete: "/api/gateways/relay-gateways/{tenant_id}/{relay_id}"
        };
    }
}

enum GatewayState {
    // The gateway has never sent any stats.
    NEVER_SEEN = 0;

    // Online.
    ONLINE = 1;

    // Offline.
    OFFLINE = 2;
}

message Gateway {
    // Gateway ID (EUI64).
    string gateway_id = 1;

    // Name.
    string name = 2;

    // Description.
    string description = 3;

    // Gateway location.
    common.Location location = 4;

    // Tenant ID (UUID).
    string tenant_id = 5;

    // Tags.
    map<string, string> tags = 6;

    // Metadata (provided by the gateway).
    map<string, string> metadata = 7;

    // Stats interval (seconds).
    // This defines the expected interval in which the gateway sends its
    // statistics.
    uint32 stats_interval = 8;
}

message GatewayListItem {
    // Tenant ID.
    string tenant_id = 1;

    // Gateway ID (EUI64).
    string gateway_id = 2;

    // Name.
    string name = 3;

    // Description.
    string description = 4;

    // Location.
    common.Location location = 5;

    // Gateway properties.
    map<string, string> properties = 6;

	  // Created at timestamp.
	  google.protobuf.Timestamp created_at = 7;

	  // Last update timestamp.
	  google.protobuf.Timestamp updated_at = 8;

    // Last seen at timestamp.
    google.protobuf.Timestamp last_seen_at = 9;

    // Gateway state.
    // Please note that the state of the gateway is driven by the stats
    // packages that are sent by the gateway.
    GatewayState state = 10;
}

message CreateGatewayRequest {
    // Gateway object.
    Gateway gateway = 1;
}

message GetGatewayRequest {
    // Gateway ID (EUI64).
    string gateway_id = 1;
}

message GetGatewayResponse {
    // Gateway object.
    Gateway gateway = 1;

	// Created at timestamp.
	google.protobuf.Timestamp created_at = 2;

	// Last update timestamp.
	google.protobuf.Timestamp updated_at = 3;

    // Last seen at timestamp.
    google.protobuf.Timestamp last_seen_at = 4;
}

message UpdateGatewayRequest {
    // Gateway object.
    Gateway gateway = 1;
}

message DeleteGatewayRequest {
    // Gateway ID (EUI64).
    string gateway_id = 1;
}

message ListGatewaysRequest {
    // Max number of gateways to return in the result-set.
    // If not set, it will be treated as 0, and the response will only return the total_count.
    uint32 limit = 1;

    // Offset in the result-set (for pagination).
    uint32 offset = 2;

    // If set, the given string will be used to search on name (optional).
    string search = 3;

    // Tenant ID (UUID) to filter gateways on.
    // To list all gateways as a global admin user, this field can be left blank.
    string tenant_id = 4;

    // Multicast-group ID (UUID) to filter gateways on.
    string multicast_group_id = 5;

    enum OrderBy {
      NAME = 0;
      GATEWAY_ID = 1;
      LAST_SEEN_AT = 2;
    }

    // If set, the given value will be used to sort by (optional).
    OrderBy order_by = 6;

    // If set, the sorting direction will be decending (default = ascending) (optional).
    bool order_by_desc = 7;
}

message ListGatewaysResponse {
    // Total number of gateways.
    uint32 total_count = 1;

    // Result-set.
    repeated GatewayListItem result = 2;
}

message GenerateGatewayClientCertificateRequest {
    // Gateway ID (EUI64).
    string gateway_id = 1;
}

message GenerateGatewayClientCertificateResponse {
    // TLS certificate.
    string tls_cert = 1;

    // TLS key.
    string tls_key = 2;

    // CA certificate.
    string ca_cert = 3;

    // Expires at defines the expiration date of the certificate.
    google.protobuf.Timestamp expires_at = 4;
}

message GetGatewayMetricsRequest {
    // Gateway ID (EUI64).
    string gateway_id = 1;

    // Interval start timestamp.
    google.protobuf.Timestamp start = 2;

    // Interval end timestamp.
    google.protobuf.Timestamp end = 3;

    // Aggregation.
    common.Aggregation aggregation = 4;
}

message GetGatewayMetricsResponse {
    // RX packets.
    common.Metric rx_packets = 1;

    // TX packets.
    common.Metric tx_packets = 2;

    // TX packets / frequency.
    common.Metric tx_packets_per_freq = 3;

    // RX packets / frequency.
    common.Metric rx_packets_per_freq = 4;

    // TX packets / DR.
    common.Metric tx_packets_per_dr = 5;

    // RX packets / DR.
    common.Metric rx_packets_per_dr = 6;

    // TX packets per status.
    common.Metric tx_packets_per_status = 7;
}

message GetGatewayDutyCycleMetricsRequest {
    // Gateway ID (EUI64).
    string gateway_id = 1;

    // Interval start timestamp.
    google.protobuf.Timestamp start = 2;

    // Interval end timestamp.
    google.protobuf.Timestamp end = 3;
}

message GetGatewayDutyCycleMetricsResponse {
    // Percentage relative to max load.
    common.Metric max_load_percentage = 1;

    // Percentage relative to tracking window.
    common.Metric window_percentage = 2;
}

message GetRelayGatewayRequest {
    // Tenant ID (UUID).
    string tenant_id = 1;

    // Relay ID (4 byte HEX).
    string relay_id = 2;
}

message GetRelayGatewayResponse {
    // Relay Gateway object.
    RelayGateway relay_gateway = 1;

	  // Created at timestamp.
	  google.protobuf.Timestamp created_at = 2;

	  // Last update timestamp.
	  google.protobuf.Timestamp updated_at = 3;

    // Last seen at timestamp.
    google.protobuf.Timestamp last_seen_at = 4;
}

message ListRelayGatewaysRequest {
    // Max number of relay-gateways to return in the result-set.
    // If not set, it will be treated as 0, and the response will only return the total_count.
    uint32 limit = 1;

    // Offset in the result-set (for pagination).
    uint32 offset = 2;

    // Tenant ID (UUID) to filter relay-gateways on.
    // To list all relay-gateways as a global admin user, this field can be left blank.
    string tenant_id = 3;
}

message ListRelayGatewaysResponse {
    // Total number of relay-gateways.
    uint32 total_count = 1;

    // Result-set.
    repeated RelayGatewayListItem result = 2;
}

message RelayGatewayListItem {
    // Tenant ID.
    string tenant_id = 1;

    // Relay ID (4 byte HEX).
    string relay_id = 2;

    // Name.
    string name = 3;

    // Description.
    string description = 4;

	  // Created at timestamp.
	  google.protobuf.Timestamp created_at = 5;

	  // Last update timestamp.
	  google.protobuf.Timestamp updated_at = 6;

    // Last seen at timestamp.
    google.protobuf.Timestamp last_seen_at = 7;

    // Gateway state.
    // Please note that the state of the relay is driven by the last
    // received stats packet sent by the relay-gateway.
    GatewayState state = 10;

    // Region configuration ID.
    string region_config_id = 11;
}

message UpdateRelayGatewayRequest {
    // Relay Gateway object.
    RelayGateway relay_gateway = 1;
}

message DeleteRelayGatewayRequest {
    // Tenant ID.
    string tenant_id = 1;

    // Relay ID (4 byte HEX).
    string relay_id = 2;
}

message RelayGateway {
    // Tenant ID.
    string tenant_id = 1;

    // Relay ID (4 byte HEX).
    string relay_id = 2;

    // Name.
    string name = 3;

    // Description.
    string description = 4;

    // Stats interval (seconds).
    // This defines the expected interval in which the gateway sends its
    // statistics.
    uint32 stats_interval = 5;

    // Region configuration ID.
    string region_config_id = 6;
}