chirpstack / chirpstack-rest-api

ChirpStack gRPC API to REST proxy.
MIT License
17 stars 14 forks source link

How to add Device Profile without knowing Regions? #16

Open lorenwest opened 12 months ago

lorenwest commented 12 months ago

The POST device-profile API has a regions element, but there is no API for listing regions. The ListRegions GRPC call appears to be an internalService (hidden).

What value can I supply in the region parameter for adding a device-profile in a particular ChirpStack install?

lorenwest commented 6 months ago

I needed the same thing, and found a list of available regions in the properties object of the ListGateways GRPC call. Here's an example response using the JSON api. You could cycle through the regions in the result to get the full list, then sort -u to get the unique list.

{
  "totalCount": 1,
  "result": [
    {
      "tenantId": "5bd0463e-403f-4cf5-bd75-236e47ee6410",
      "gatewayId": "00005813d3165d7f",
      "name": "Browan",
      "description": "",
      "location": {
        "latitude": 0,
        "longitude": 0,
        "altitude": 0,
        "source": "UNKNOWN",
        "accuracy": 0
      },
      "properties": {
        "region_common_name": "US915",
        "region_config_id": "us915_1"
      },
      "createdAt": "2024-02-29T20:32:48.108102Z",
      "updatedAt": "2024-02-29T20:32:48.108102Z",
      "lastSeenAt": "2024-03-05T04:55:49.633266Z",
      "state": "ONLINE"
    }
  ]
}