java api
Closed this issue · 1 comments
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
What happened?
I generated the java api, everything seems to work, authentication is ok, after some extra efforts how to inject the bearer token to the calls even this works and I'm able to create an application via the api
//create application
ApplicationServiceBlockingStub applicationservicestub=io.chirpstack.api.as.external.api.ApplicationServiceGrpc
.newBlockingStub(channel)
.withCallCredentials(btoken);
Application application=io.chirpstack.api.as.external.api.Application.newBuilder()
.setName("wasserstandsmesser2")
.setDescription("mydescrioption")
.setOrganizationId(2)
.setServiceProfileId("91ca668f-64c1-484f-aeff-9a05098c6389")
.build();
CreateApplicationRequest apprequest=CreateApplicationRequest.newBuilder()
.setApplication(application)
.build();
CreateApplicationResponse applicationresponse=applicationservicestub.create(apprequest);
with applicationresponse.getId() I get the created id. when I try to create a device with the similar code
//create device
DeviceServiceBlockingStub deviceservicestub=io.chirpstack.api.as.external.api.DeviceServiceGrpc.newBlockingStub(channel).withCallCredentials(btoken);;
io.chirpstack.api.as.external.api.Device device=io.chirpstack.api.as.external.api.Device.newBuilder()
.setApplicationId(applicationresponse.getId())
.setName("devicename")
.setDescription("description")
.setDevEui("0018b20000023065")
.setDeviceProfileId("94b0900e-9124-4ba4-89a6-33ee4eebc5f0")
.build();
io.chirpstack.api.as.external.api.CreateDeviceRequest createdevicerequest=io.chirpstack.api.as.external.api.CreateDeviceRequest
.newBuilder()
.setDevice(device)
.build();
deviceservicestub.create(createdevicerequest);
I found out that the create function only returns an Empty Datatype
What did you expect?
I expected to get the id of the created device. The function create should return a type of sth like createdeviceresponse.
I think there is an error in the protobuf
Your Environment
Component | Version |
---|---|
ChirpStack API | v3.12.4 |
I found out that the create function only returns an Empty Datatype
Which is correct, see:
https://github.com/brocaar/chirpstack-api/blob/master/protobuf/as/external/api/device.proto#L20
I expected to get the id of the created device
The ID of the device is the DevEUI, which you already provided when making the device request.