API name conflict in local server?

Hi Guys,

I just reviewed the local server page.

i found below API:

#Get Core attributes
GET /v1/devices/:coreid
#Get all my Events
GET /v1/devices/events

I just confuse for how the server distinguish to the ‘events’ or ‘:coreid’ ?

The colon in :coreid indicates an ID, which can then be handled with appropriate code, whereas events is ‘merely’ a URL to which you can navigate. (about 50% sure that’s correct ;))

events is not just a url which used for navigate, it will subscribe the properly events. ''events" will be identify as a coreid, if it be routed after “:coreid”, i suppose.

I see your point now.
I renamed my Core to events with the coreID 53ff6d065075535140381687;

would give me the Core attributes correctly like so:

  "id": "53ff6d065075535140381687",
  "name": "events",
  "connected": true,
  "variables": {
    "temp": "double",
    "humi": "double"
  "functions": [
  "cc3000_patch_version": "1.29"

Would subscribe me to all my events (notice different coreIDs):


event: pubdata
data: {"data":"{\"t\":17.20,\"h\":53.30}","ttl":"60","published_at":"2015-01-16T13:56:22.652Z","coreid":"53ff6d065075535140381687"}

event: color_values
data: {"data":"{\"r\": 0, \"g\": 134248145, \"b\": 536891240}","ttl":"1","published_at":"2015-01-16T13:57:01.969Z","coreid":"50ff77065067545650270487"}

If you’re planning on using the core’s name to access it, then yes, I guess you could say there’s a conflict, in the unlikely event that someone would call their Core “events”. I personally would stick to the coreID to indentify my Core since that is not likely to change, whereas the name is.
Perhaps @dave can elaborate this in a bit more detail(?)

Sounds right, if you’re using the name “events”, it’ll probably match a wildcard route. :slight_smile:


1 Like

@Moors7 , thanks your reply,

I mean , not using the core name , but only use coreid , I just tested, this will related to the setting order.

There are code in the main.js:


if we alternate the load order to below , then the issue will comes out.


Express, will check if the the /** name is belong to the routers first , then variables, So it will realted to the setting order .

Please , forgive me for my question if it is so easy, I am almost a fresher for nodejs.

1 Like