Receiving JSON from other API to control

#1

Hello everyone.
My goal is implementation of RPC mechanism. I have the MONGOOSE OS firmware, which I could control by RPC with JSON.
And I have the working API from another source which send me JSON, too.
So is there any solutions to combine this? I want to control it via another API, not by myself.
Thanks.

#2

Maybe RPC - Remote Procedure Calls can help?

#3

Or maybe https://ifttt.com?

#4

@dsmyalkovskiy also, if you sketch a simple example, that would help.

#5

Thanks, I’ve user this function tto receive JSON. But is there a function which call some URL to receive JSON? For instance every minute.

#6

Thank you, but the main thought is using mongoose os without some back end.

#7

So I have this function in my main
mg_rpc_add_handler(mgos_rpc_get_global(), “RPC_PWM”, “{R: %d, G: %d, B: %d, NUM: %d FREQ: %d}”, rpc_pwm_control, NULL);

Which controlling the light dimming and fading. And with
mos --port ws://192.168.178.83/rpc call RPC_PWM {’“R”: 255, “G”: 1, “B”: 1, “NUM”: 100, “FREQ”: 10}’
I could control my system.
Also there is an working API, which send JSON. And the question is : could mongoose call this API (like curl https://blala) from another source and process it without my intervention?

#8

If you use mdash.net, then you could use curl / HTTPS to call any RPC function. See https://forum.mdash.net/t/rest-api-reference/45

#9

Thank you, I’ll try it tomorrow.