Hi, it looks like there is an error in the 10.6 version. I try to consume OData service but getting 400 Bad Request with a simple Read operation. Response content for GET request to https://xyz.com:8443/fmi/odata/v4/APP/Person?$select=id%2Ccode&$count=true&$top=20&$orderby=id%20asc HTTP/1.1 400 Bad Request Date: Sat, 23 Dec 2023 23:44:08 GMT Server: Apache Strict-Transport-Security: max-age=31536000; includeSubDomains; preload X-Frame-Options: SAMEORIGIN Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Authorization Access-Control-Allow-Methods: PATCH, GET, POST, DELETE, OPTIONS OData-Version: 4.0 Content-Type: application/json;charset=utf-8 Content-Length: 106 X-XSS-Protection: 1; mode=block Access-Control-Allow-Headers: Content-Type, Authorization Access-Control-Allow-Credentials: true X-Content-Type-Options: nosniff Connection: close {"error": {"code": "8309","message": "The field named 'id,code' does not exist in a specified table (9)"}} I don't know why OData provider treats `id%2Ccode` as a single name instead of two fields separated by a comma. The fields in the `$select` are separated with `%2C`, which means, `.` If I pass this URL into Postman, I get the same error. However, if I replace `%2C` with `,` the request works fine. Do you have any ideas? Does the Mendix or OData provider not decode the URL correctly? Thanks
asked
Jacek Pietsch
2 answers
1
It looks like the spec for ODATA defines COMMA as ',' or '%2C'. So it looks like it is being encoded correctly, but the service that is being called isn't decoding it correctly.
See section 9 - https://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/abnf/odata-abnf-construction-rules.txt
answered
Robert Price
0
Hi Jacek,
There's a function called urlEncode that could help you in the way to properly enconde the URL that you're trying to build.
In the construction of your URL, you can put the urlEncode surrounding the Person?$select=id%2Ccode&$count=true&$top=20&$orderby=id%20asc. part.
I've used it in the past, in a different Mendix version and i've never found issues like that because it's putting a dot instead of a comma.
Another workaround would be that you put the comma directly in your URL construction and replace it the the code associated by doing a replacement.
Without more context it's hard to understand where could be the problem, but i advise to check the code and also take a look on the documentation of the ODatas encoding, because if you use the exact same URL working from Postman in Mendix it should work.