Retrieve Fiware-ServicePath from EntityContext using EntityID

152 views Asked by At

I could not find detailed documentation about Entity Service and Service Path, this is best i could find is this section in the Orion User Manual

I would like to retrieve a "Fiware-ServicePath" for a specific Entity_ID but NGSI10 does not provide that information using queryContext.

Is there a way of retrieving this information ?

My process is described here, everything is working except the the Get ServicePath using EntityID part:

  • A gateway is pushing data into Orion and i would like to make to "update or insert procedure":
    • Get ServicePath using EntityID
      • IF exists: update it
      • If not exists: updatecontext with ServicePath '/NewItems'

As a workaround, I would add the ServicePath into some metadata...

1

There are 1 answers

4
fgalan On BEST ANSWER

You can add Fiware-ServicePath: /NewItems to the query request in order to check if the entity is in that service path or not. You can also add a comma-separated list, e.g. Fiware-ServicePath: /NewItems1, /NewItems2.

This approach would work except if the entity can be in any service path (even diffent to the "/NewItems" that is going to be use to create entity failing the existence checking) and you don't know them in advance.

In that case, the workaround by the moment is as you say, to store the service path associated to the entity, although my recomendation is to use an entity attribute for that, not a metadata (note that in NGSI metadata are associated to attributes, not entity themselves).