Lookup tables in webhooks?

Is it possible to build a lookup table into a webhook?

I have a working webhook with the URL:
http://SERVER/api/plugins/telemetry/{{t}}/{{i}}/values/timeseries
If I call this with
Particle.publish("thingsboard-in","{\"t\":\"DEVICE\",\"i\":\"xxxx-device-id-xxxxx\"}",PRIVATE);

This works fine. What would be nice is if I could send a text string for my device ID and do a lookup. That would mean if for some reason the device ID changes, I don’t need to reflash any devices with that encoded in.

In a custom template, I’ve added:

    "l": {
        "Greenhouse": "xxxx-device-id-xxx"
    }

And then call the webhook with:

Particle.publish("thingsboard-in","{\"t\":\"DEVICE\",\"d\":\"Greenhouse\"}",PRIVATE);

However, I can’t find a URL format to lookup this data. I have been trying things along the lines of:
http://SERVER/api/plugins/telemetry/{{t}}/{{l.d}}/values/timeseries

What I’m trying to say is, in the URL substitute the value of l.d, where ‘d’ is a text string reference and the value returned should be a valid device id. Is this possible?

There is no such feature but for that …

… you wouldn’t need to reflash anything when you store the dynamic portion in EEPROM and provide a Particle.function() to update that part remotely :wink:

Alternatively you could use the device name or device notes to store the “role” in the Particle cloud and have your code request its role on startup.

Thanks, I like that idea.

I suppose another option is to pull the string to device ID mapping from a web server on startup via another hook

just to reinforce what ScruffR mentioned in his post above, you can let that web server be the particle cloud and use the device notes as explained here:

Thanks, that is a really useful resource