Dynamic URL in proxy

I’m facing an issue with using a HTTP proxy for which I currently see no solution. I hope you’ll be able to help me.

I’ve created a http proxy for forwarding requests to an external party. In the URL I need to specify an id. So my request URI in the http proxy looks somewhat like this: https://www.example.com/${id}/dosomething

This ID is given in the POST data that the proxy receives.

However: the external URL expects the POST data to contain some specific format. For example:
{“field1”: “Value1”, “field2”: “Value2”}.

Since the id is specified in the POST body, currently my outgoing body will look like this: {“field1”: “Value1”, “field2”: “Value2”, “id”: “1234”}.

I can use a key filter transformer to filter the id field from the body, but then my outgoing URL is incorrect since it can’t find the id field in the body.

So it seems currently my only options are to have the id in both the URL and the body, or to have it in neither.

So how do I keep my id field in the URL, but strip it out of the body?

Hi @freek.vandeursen ,

Welcome to the Alumio forum.

You are correct that if you only put the id in the body and use Key filter to remove it, the Request URI will not be able to fetch the id anymore.

However, I just tried putting the id in the query parameter, for example:

https://some-env.alumio.com/api/v1/http-proxy/test-remove-required-key?code=200

It worked even when I didn’t put the id in the body, but I needed to check the “Merge GET parameters” option in the “Transform request data” processor.

However, the query parameter also got forwarded to the external URL. Could you please check whether the external URL would ignore the query parameters?