I’m trying to use the List request device profile using gRPC. My issue is while executing the function I’m only getting the total number of device profile but not the device profiles available
There are use-cases where you want to get the total count, but not all the items. If you have thousands of devices for example, this might generate a lot of data if all you are interested in is just the total number of devices.
Note that gRPC / Protobuf defaults to the default type values in case these are not set. E.g. an integer defaults to 0, a string to "", a boolean to false etc… That is why the limit defaults to 0 if not set.
The device gets successfully created on chirpstack UI but is there a way to determine that the response received was a success?
When the response is not successful the response I get is
<bound method _InactiveRpcError.details of <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INTERNAL
details = "duplicate key value violates unique constraint "device_pkey""
debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"duplicate key value violates unique constraint \"device_pkey\"", grpc_status:13, created_time:"2023-09-12T18:12:15.538084+05:30"}"
on successful response I get a blank
Is there a way to get the status code/success response that can be checked.?
It depends on the gRPC implementation how these are exposed. I’m not sure which implementation you are using, but it might be that everything which is not an OK is exposed as an exception.
As I mentioned before, if response does not contain the status code, it might be that the gRPC implementation that you are using is using exceptions in case the status is anything other than OK. In such case you would use something like try / except to handle potential errors.