I am developing a temperature sensor application.
My end device send 3 frame types and I use one port for each.
I can prepare differently JSON payload format based on fport.
Now I am wondering if I can redirect HTTP post to a different endpoint for each frame type.
I use HTTP integration and for the moment I can only Post to one endpoint OR I can create 3 integration with 3 different URL and post all frame types to all endpoints. But I don’t want to flood my API with useless HTTP Post.
Is it possible to select an endpoint based on fport ?
The option doesn’t exist on the console or in the command line utility …
There is nothing in MQTT that allows you to subscribe to a port either.
Use one endpoint (thus saving on TTN community server processing with your three way idea) and code your script to do different things based on the included port information.
Or if the endpoints are on other servers, then the one script can process its port and just proxy/forward the message to the relevant other endpoints. Or have one forwarding script to three others.
That’s what I want to do. But I can’t find option in payload format script that allowed to do that.
Is it possible in TTN payload format ? If yes, how to ?
If not, how to implement a redirect script to forward payload to the relevant endpoint ?
Above “your script” refers to something outside of TTN.
Thank you for your answers.
I think it could be interesting to have the possibility to redirect to several endpoints in HTTP integration.
Sure, see, e.g., How add data field to URL in HTTP Integration? But even V3 does not support that so don’t hold your breath. Aside: a lot will change in V3, so make sure your application is generic. Like: in the endpoint extract the data you need as early as possible, rather than passing the full JSON data to your actual application code.
Thanks, I have adapted it and it works well