We have two kind of api url's
1) RESTful style clean urls - http://x.x.x.x/api/records1/{entityId1}/records2/{entityId2}
2) Query string to search - http://x.x.x.x/api/records1?filter1={filterString}&filter2={filterString}....
In first case {entityId's} where data can have "/" like "a/b" and as you mentioned above it can be multiple times which based on how deep the Url is and
In second case also it could be multiple times as part of {filterString}
Now, the requirement is we don't need to touch the querystring part, it means if %2F or %5C is part of {filterString} let it be, it's working fine.
Only if it is part of {entityId} then need to doubleescape. Inshort, only need to resolve for case 1.
Let me know what could be good Url rewrite
Thanks