Empty request body in Android CloudSDK ParticleDevice.callFunction() execution

photon
Tags: #<Tag:0x00007fe21f779648>

#1

Hello folks,

I’m using the Android CloudSDK library (https://github.com/particle-iot/particle-android/tree/master/cloudsdk - rev 0.5.1) and seeing an issue.

I’m making the call:

io.particle.android.sdk.cloud.ParticleDevice.callFunction(“updateState”, listOf(“test”)), but the resulting okhttp request seems to be lacking a request body, instead of containing the expected “test” content:

(extracted using Charles proxy)

:method: POST
:path: /v1/devices/3c0033000f47353136383631/updateState
:authority: api.particle.io
:scheme: https
authorization: Bearer XXXXX
content-type: application/json; charset=UTF-8
content-length: 2
accept-encoding: gzip
user-agent: okhttp/2.7.5

{}

Using the serial debugger on the target device, I confirm that the function ‘updateState’ is indeed being called with an empty argument.

Has anyone else seen this?

I should also note that this has worked for over a year, but I only recently came back to this project and noticed these calls were failing… I’m willing to accept it’s my fault somewhere :slight_smile: I just can’t figure out why the rendered http request is stripping out the body.

(p.s. Particle is awesome and all of these tools are awesome. This is the first time I’ve had to post something in years :slight_smile: )