device resource api

amin 2 years ago

hi
while im updating device i trace code,but the put method in deviceresource class(api) does not invoke .so i dont understand how it works?

Anton Tananaev 2 years ago

You're clearly missing something. The code should be invoked.

amin 2 years ago

when i click save buttom , it goes to constructor of DeviceResource class, then it goes to put method in BaseObjectResource Class, after that it get back to constructor of DeviceResource class and finally it goes to get method of DeviceResourcs class. but put method in DeviceResourcs class does not invoke in this loop.

Anton Tananaev 2 years ago

DeviceResource does not override the PUT method, so it is correct that the implementation in BaseObjectResource is called. Sounds like everything is working as expected.

amin 2 years ago

so what is the role of put method in DeviceResource class? isnt it api of update device?

Anton Tananaev 2 years ago

You mean updateAccumulators? It's to update accumulators.

amin 2 years ago

yes exactly.

amin 2 years ago

what is accumulators.?

Anton Tananaev 2 years ago

Accumulators are things that accumulate values. Currently we have distance and engine hours accumulators.

Ashok Chandra 2 years ago

I am also confused with DeviceResource.java there is no POST method, first I think PUT method is doing work as POST. When I removed the all PUT codes from file.I recompile and replace all files. after that add device function are working. How this possible.

Where is the code for adding device where is POST method for add device.

Amir 2 years ago

Exactly the api address is api/devices but the invoked method in parent class

Amir 2 years ago

The api implement in baseresource class.