Remote Procedure Call doesn't work through API

I’m calling procedure on device using API and this seems doesn’t work. The same parameters works perfectly from web console:

curl -X 'POST' \
  'https://api.golioth.io/v1/projects/test_1/devices/<REDACTED>/rpc' \
  -H 'accept: application/json' \
  -H 'x-api-key: <REDACTED>' \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "number",
  "params": [
    { "process_code_push" : 100 }
  ],
  "timeout": 4
}'
Response from Open API:
Code 200
Response body
{
  "statusCode": 14,
  "detail": null
}

Could you please help me figure our what is wrong? Does json structure in request correct? What statusCode: 14 means?

Thank you

Hi Leg,

Can you share which Golioth SDK and version you are using?

Thanks,

Dylan

Sure. Version: 0.6.0.
Just want to add that calls from web console to the same client and callbacks work fine

Perfect thanks that is helpful information for us track this one down! To confirm are you using Zephyr and our Zephyr SDK?

Nope. We’re using Golioth Firmware SDK on Espressif ESP-IDF with ESP32-S3

Hey Leg,

That make sense! In your curl command here it looks like you’re passing number as the method name. I expect however the name of your function in your firmware is actually process_code_push. Is that correct?

If so your CURL command should look more like this:

curl -X 'POST' \
  'https://api.golioth.io/v1/projects/test_1/devices/<REDACTED>/rpc' \
  -H 'accept: application/json' \
  -H 'x-api-key: <REDACTED>' \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "process_code_push",
  "params": [
    {100}
    ],
  "timeout": 4
}'

The statusCode 14 is coming from the device itself indicating that the RPC method was unavailable (we can improve our documentation here).

I can see in our OpenAPI Docs that we use the example value “string” for the method name which is confusing. Let us know if that works!

Hi Dylan,

Thank you! It works now!
I just made small adjustment in your CURL command as our callback expects number:

curl -X 'POST' \
  'https://api.golioth.io/v1/projects/test_1/devices/<REDACTED>/rpc' \
  -H 'accept: application/json' \
  -H 'x-api-key: <REDACTED>' \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "process_code_push",
  "params": [
    100
    ],
  "timeout": 4
}'

Glad that worked! For future posts (and for others reading this in the future) be sure not to share API keys in forum posts. I removed that and your device ID from your response.