I am implementing a REST-like API and have just faced an interesting problem. There is a need to provide a resource with an open list of query parameters to filter the results. For example:
GET /api/items?field1=value1&field2=value2
Field names are configurable, so I don't have the complete list of possible names.
There are also parameters with special meaning, e.g. orderBy=field5
The problem is when there is a field with the same name as one of the pre-defined parameters. The API has to somehow distinguish between them.
Many command-line programs use two hyphens ("--") to mark the end of options and start of arguments. I think of something analogous in URLs.
Is there any good practice in this subject?