Cancel
Showing results for 
Search instead for 
Did you mean: 

[dataexchange API] Using the filter param when listing directories

Valued Contributor
Valued Contributor

I'm trying to filter the directories from the data exchange api by name. The docs say, that you can use a filter param, however, the docs don't say how to used it.

 

I tried several formats, but it looks like this endpoint invents its own syntax once again, because hey, why use the one from the identity management api or the other one from the iot time series api if you can be creative all over again? Smiley Very Happy

 

So, here's what I tried amongst other things:

 

`?filter=my-directory-name`

`?filter="my-directory-name"`

`?filter=name eq "my-directory-name"`

`?filter={"name": "my-directory-name"}`

 

But yeah.. the response is always this:

 

`Wrong filter option. Filter accepts starting or trailing wildcards (*) and at least three characters.`

 

Any hint how to use this? 

11 REPLIES 11

Re: [dataexchange API] Using the filter param when listing directories

Legend
Legend
I have just done a quick test, and I experience the same issue. I can create and get directory results, but whenever I try to use the filter parameter, the answer is always empty.

Worse, it's not really well documented how to apply this parameter. Does it only search on names? also on ids? is there a syntax for that?

I'm assuming it must have anything to do with S3's syntax, but unsure.

Re: [dataexchange API] Using the filter param when listing directories

Creator
Creator

I notice there is an example here...
https://developer.mindsphere.io/apis/iot-iotfile/api-iotfile-references-filtering.html

It does use single quotes instead of double...

https://{host}/api/iotfile/v3/files/978528e7a124458f87c8f1d38fd9400f?filter=name eq 'result*.txt' &order=name&limit=10&offset=1

Could this maybe be the difference?

Filtering seems to e allowed on the following fields acording to the docs...

  • File update timestamp
  • File path
  • File name



Re: [dataexchange API] Using the filter param when listing directories

Legend
Legend

This filter seems to follow different rules, trying your syntax gets me a validation error:

 

GET /api/dataexchange/v3/directories/_PRIVATE_ROOT_ID?filter=name%20eq%20%2Adir%2A

{
"errors": [
{
"code": "mdsp.core.dataexchange.wrongArgumentException",
"logref": "<hidden>",
"message":"Wrong filter option. Filter accepts starting or trailing wildcards (*) and at least three characters."
}
]
}

whereas if I provide what is documented, validation passes but the output is empty:

GET /api/dataexchange/v3/directories/_PRIVATE_ROOT_ID?filter=%2Adir%2A

{
  "files": [],
  "directories": [],
  "page": {
    "number": 0,
    "size": 0,
    "totalPages": 0,
    "totalElements": 0
  }
}

Re: [dataexchange API] Using the filter param when listing directories

Valued Contributor
Valued Contributor

@Rob_M  Note that I'm referring to the `dataexchange` API here, not the `iotfile` API

But nevertheless, using single quotes does not solve it unfortunately.

Re: [dataexchange API] Using the filter param when listing directories

Creator
Creator

Yes, my mistake. I had my head in the IOT File API and misread your post. Unfortunate that the single quotes do not work.

Re: [dataexchange API] Using the filter param when listing directories

Experimenter
Experimenter

Hi,

Data Exchange currently accepts leading and/or trailing wilcards (*) as filters - just be make sure though that there aren't any issues with the service, we'll do a quick test. I'll update the post with an example.

Re: [dataexchange API] Using the filter param when listing directories

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

Hi,

 

The filter option is not working as expected. Did you get a chance to test it.

 

Re: [dataexchange API] Using the filter param when listing directories

Legend
Legend
I know that an internal issue was filed, but it doesn't seem the fix has been deployed yet. I have just tested and I get the same issue.

Re: [dataexchange API] Using the filter param when listing directories

Legend
Legend
Since the 24th April release, this works now properly for me.