Skip to content

GetFieldVisitDataByLocation - Parameters with commas don't parse properly #106

@zmoore-usgs

Description

@zmoore-usgs

Hello,

I've found a bit of a quirk with how parameters are filtered for the GetFieldVisitDataByLocation request in version 19.3.

We have several parameters which include a comma in their name, for example Water level, depth LSD, and when trying to use these parameters as the filter in GetFieldVisitDataByLocation I end up getting no readings returned, despite there being readings with that parameters.

I played around with the API directly a bit outside of the SDK and it seems the issue is that commas are used by the API to delimit multiple values being passed in for the parameter, meaning that when I pass in Water level, depth LSD by itself it gets split into two parameters: Water level and depth LSD, neither of which are actual parameters in our system.

When using the API directly I was able to work around that issue by quote-wrapping the value and then it seemed to properly include the whole parameter singularly rather than splitting it up, i.e: ...&Parameters="Water level, depth LSD", however this workaround doesn't work in the SDK.

It seems that when making the request through the SDK the parameter values have any wrapping quotes stripped here: https://github.com/AquaticInformatics/aquarius-sdk-java/blob/develop/src/main/java/com/aquaticinformatics/aquarius/sdk/helpers/SdkServiceClient.java#L203.

I tried manually prefixing/suffixing the string with escaped quotes before adding it to the FieldVisitDataByLocationServiceRequest instance, i.e:

new FieldVisitDataByLocationServiceRequest()
    .setParameters(Arrays.asList("\"Water level, depth LSD\""))
    ...
...

But that resulted in the slashes also being propagated through to the request URL, which ended up as:

.../AQUARIUS/Publish/v2/GetFieldVisitDataByLocation?&parameters=%5B%5C%22Water+level%2C+depth+MP%5C%22%5D ...

For now I'm working around this issue by not filtering on Parameter when making the request and doing it client-side on the response, but it would be great if I could offload that filtering to the API, so any help with this issue would be appreciated! Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions