eclipse-ditto / ditto

Eclipse Ditto™: Digital Twin framework of Eclipse IoT - main repository
https://eclipse.dev/ditto/
Eclipse Public License 2.0
694 stars 230 forks source link

Provide APIs to search for features #1421

Open thjaeckle opened 2 years ago

thjaeckle commented 2 years ago

After having formulated the 2 "bulk API" ideas in #1419 and #1420 I think it becomes quite obvious that in order for those to work Ditto would need an additional API to "search" for features.

Currently Ditto can search and find things, e.g. via HTTP API:

GET /api/2/search/things?filter=eq(attributes/manufacturer,'Eclipse')&fields=thingId
response (list of found thingIds):
[
  {"thingId":"org.eclipse.ditto:thing-1"},
  {"thingId":"org.eclipse.ditto:thing-3"},
  {"thingId":"org.eclipse.ditto:thing-3"}
]

GET /api/2/search/things?filter=eq(attributes/manufacturer,'Eclipse')
--> returns as convenience the actual payload of all found things

It might however be sometimes more relevant to find features instead. This could be an example HTTP API for that:

GET /api/2/search/features?filter=eq(properties/on,true)&fields=thingId,featureId
response (list of found thingId + featureId combinations):
[
  {"thingId":"org.eclipse.ditto:thing-1","featureId":"myFeature-0815"},
  {"thingId":"org.eclipse.ditto:thing-3","featureId":"myFeature-0815"},
  {"thingId":"org.eclipse.ditto:thing-3","featureId":"myFeature-0815"}
]

The response of such a search would of course have to contain:

As convenience the payload of the matched features could be returned, e.g. in such a way:

[{
  "thingId": "org.eclipse.ditto:thing-1",
  "featureId": "myFeature-0815",
  "definition": [
  ],
  "properties": {
  },
  "desiredProperties": {
  }
}]
Abhijeetmishr commented 1 year ago

@thjaeckle can I pick up this & can you guide me through it.

thjaeckle commented 1 year ago

@thjaeckle can I pick up this & can you guide me through it.

@Abhijeetmishr could you please explain your motivation to work on this rather complex topic? Are you missing that particular feature from Ditto?

Abhijeetmishr commented 1 year ago

@thjaeckle maybe I could have interpreted this issue wrongly I thought that we have to enhance existing API to support multiple parameter very likely I may me wrong because I am complete newbie to open source and ditto as well.