Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behavior in /ratio endpoint regarding filter2 parameter #264

Open
apibugsreporting opened this issue Feb 17, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@apibugsreporting
Copy link

Bug Description

In the /elements/count/ratio/groupBy/boundary endpoint, sometimes when not using the filter2 parameter, an error is returned. Some other times, the request is successful and data is returned.

General Information

Please include the following general information about the issue and list any additional steps needed to reproduce the bug.

  • Version of the ohsome API [e.g. 1.5.0]
    • 1.6.1
  • Which API instance was requested [e.g. remote instance at https://api.ohsome.org/v1, local instance with an h2 file or connected to the cluster, etc.]
    • Remote instance at https://api.ohsome.org/v1
  • Affected endpoint(s) [e.g. /contributions/count]
    • /elements/count/ratio/groupBy/boundary
  • URL of your request (and request body if applicable)
    • https://api.ohsome.org/v1/elements/count/ratio/groupBy/boundary?filter=oneway%21%3D*%20and%20id%3A%281%20..%209999%29&types2=point%2Cline%2C&format=json&showMetadata=true&time=2009-05-02&keys2=highway&timeout=60&values2=track&bcircles=lf%3A8.704%2C49.4055%2C2%7Cj%3A8.705303%2C49.412%2C3%7Cc%3A8.704%2C49.4060%2C88
  • Used HTTP method [GET or POST]
    • Both
  • Utilized tool/library for the request [e.g. cURL, Postman, ohsome-py, etc.]

Expected Behaviour

With the previous request, the following response body is obtained:

{
    "timestamp": "2021-10-31T06:39:03.01736",
    "status": 400,
    "message": "The filter2 parameter has to be defined when using a /ratio endpoint.",
    "requestUrl": "https://api-test.ohsome.org/v1/elements/count/ratio/groupBy/boundary?filter=oneway%21%3D*%20and%20id%3A%281%20..%209999%29&types2=point%2Cline%2C&format=json&showMetadata=true&time=2009-05-02&keys2=highway&timeout=60&values2=track&bcircles=lf%3A8.704%2C49.4055%2C2%7Cj%3A8.705303%2C49.412%2C3%7Cc%3A8.704%2C49.4060%2C88"
}

However, when making the following request: https://api.ohsome.org/v1/elements/count/ratio/groupBy/boundary?keys=highway&types2=point%2Cother&values=secondary&timeout=85&bcircles=8.7450%2C49.435%2C5%7C8.723%2C49.408%2C1

Which does NOT include the filters2 parameter, a successful response is obtained:

{
    "attribution": {
        "url": "https://ohsome.org/copyrights",
        "text": "© OpenStreetMap contributors"
    },
    "apiVersion": "1.6.1",
    "groupByBoundaryResult": [
        {
            "groupByObject": "boundary1",
            "ratioResult": [
                {
                    "timestamp": "2021-07-25T21:00:00",
                    "value": 0.0,
                    "value2": 0.0,
                    "ratio": "NaN"
                }
            ]
        },
        {
            "groupByObject": "boundary2",
            "ratioResult": [
                {
                    "timestamp": "2021-07-25T21:00:00",
                    "value": 0.0,
                    "value2": 0.0,
                    "ratio": "NaN"
                }
            ]
        }
    ]
}

Further Information

Additional Information

Test report of the API request obtaining a client error response:

Test report of the API request obtaining a successful response:

@apibugsreporting apibugsreporting added the bug Something isn't working label Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant