1

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...

Cœur
  • 37,241
  • 25
  • 195
  • 267
Xavier
  • 440
  • 4
  • 11

1 Answers1

0

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).

fgalan
  • 11,732
  • 9
  • 46
  • 89
  • I have been using this work around but i'm facing a related problem. When you want to delete an entity, you need to provide its ServicePath, Then how do you delete an item if you don't know it's service path ? – Xavier Jun 26 '15 at 12:48
  • I understood that you were storing the service path in an entity attribute. In that case, it is easy to get the service path associated to each entity. – fgalan Jun 26 '15 at 16:12
  • Indeed, for that entities it's ok. But i added some test entities in "test" servicepath which i don't remember, is there a way to delete them then ? – Xavier Jun 26 '15 at 20:47
  • 1
    Thus, I understand that it would be a follow up question on "How can I delete entities belonging to a service path that I don't remember?" or something like that. Could you post it as a separate post question, please? It is better not mixing different questions at StackOverflow in the same post for the sake of clarity for the developers community. As soon as I spot the question, I would provide a solution. Thanks! – fgalan Jun 29 '15 at 21:05