Hi Andrew,
Very interesting question. I just did some tests and reviewed the OData V4 specifications, and here's my observation.
It appears that the filter "values" can be encoded, but the OData filter syntax itself cannot be encoded.
See section 2.2 URL Syntax on this page:
http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html
The examples provided are not great, but notice that the parentheses are not encoded--only the filter "values" inside the parentheses are encoded.
The OData standard appears to have some optional conventions, so I have found that Business Central doesn't support all of the specifications in that documentation, but seems to support most.
I did a test with the BC Web API, and here's what I found:
Unencoded filter works properly:
items?$filter=number eq '1896-S'
Fully encoded filter does not work (filter ignored):
items?$filter%3Dnumber%20eq%20%271896-S%27
Equals sign is NOT encoded, but everything after equals sign is encoded works:
items?$filter=number%20eq%20%271896-S%27
Based on this last test, encoding spaces AND apostrophes works for me
I then tested with date ranges, which also worked:
purchaseInvoices?$filter=(invoiceDate%20ge%202021-01-01)%20and%20(invoiceDate%20le%202021-02-01)
This above example appears to be essentially the same as what you are using.
The one thing I notice is that you have & before your "$filter" keyword.
Can you try ? before the $filter? In my example above, I'm using purchaseInvoices?$filter...
Here's a full URL example:
.
Let me know if the & vs ? makes a difference.