Problem/Motivation
My API I want to proxy is something like `https://api.example.com/search?clientId=4583&contentTypeId=CODES&fragmen...` but all I want to expose is the `&searchText=pool` and really just the value of the URL parameter "pool".
Setting the service URL to a URL with query parameters doesn't seem to work.
* description = @Translation("Proxies requests to api.example.com"),
* serviceUrl = "https://api.example.com/search?clientId=4583&contentTypeId=CODES&fragmentSize=200&isAdvanced=false&searchText=",
I would like the exposed URL that proxies to just be `/api-proxy/api-slug?_api_proxy_uri=pool`
How is that possible?
Side note the docs are a bit lacking for begginers and this reddit thread helped to understand what I need to do https://www.reddit.com/r/drupal/comments/hpb85g/how_to_implement_a_modul...
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
e0ipsoIf you search the module for the
serviceUrlyou will see that you can override the method.To provide whatever you need.
I would love to improve the docs. Could you write the documentation you would have liked to have as a beginner, now that you understand it better?
Comment #3
nicholass@e0ipso Thanks I will give that a shot, its much better than what I was trying to do by overriding the preprocessIncoming I think.
The below was working but required me to request

/api-proxy/api-municode?_api_proxy_uri=search%2F%3FsearchText%3DPoolin order to get results for "Pool" from the APIAnd yes I will help with updating the docs, mainly my confusion was the same as that reddit thread. Us front end guys I guess need it spelled out that "Create a proxy plugin" means a custom module with a file located at `/src/Plugin/api_proxy/Example.php' An example on Github also helped clarify what I needed to do https://github.com/weaver299/asc_cors_proxy.
Comment #4
nicholassSo I tried to override the `getBaseUrl()`
Drupal URL request is now
/api-proxy/api-municode?_api_proxy_uri=pool(awesome nice and clean)But it seems the module always prepends a "/" so what is actually being requested is
"https://api.municode.com/search?clientId=4583&contentTypeId=CODES&pageNum=1&pageSize=5&stateId=9&titlesOnly=true&searchText=/pool"(the end `&searchText=/pool` is the problem needs to just be `&searchText=pool`) I think this line is what is adding that forward slash https://git.drupalcode.org/project/api_proxy/-/blob/8.x-1.x/src/Plugin/H...So I guess a path is always expected, and I can't just open up a query parameter to only be modified?