Expose REST - a better way to handle dynamic fields?

Expose REST - a better way to handle dynamic fields?

Outsystems web app provides public REST web service, internally the web service consumes a external web service that process the actual request and provides a response, this external web service uses dynamic fields.

Most elements are unknown. (some elements are known and first parsed before sending the data off to the external web service).

Consumer web app --send JSON request----> Outsystems REST web service ----sends JSON request---> external web service.
How do you get outsystems Expose REST to handle dynamic fields efficently? 

One solution I found to work (but not very efficent solution) is to create a MetaData structure record list with a structure record containing two attribute field "Name" and "Value". Expose this as a REST web service, then read from the reqest and convert the MetaData list to a dynamic JSON content send that to the external web service to process the request. This works but it is a not an efficent solution! Is there a better way to handle this?

Hi Robert,

As far as I know, for your use case, I think that that is a fairly valid solution.

In fact, I would say that you should develop a service that have a "contract" to avoid these kind of things.
What am I saying here?

In my point of view, you should have several REST enpoinds, one for each purpose and in your "intermediate" layer, have a key that indentifies which service is to call and a Text parameter with the valid JSON to pass to that service (that have a structure compliant to the referred Text JSON). This way, you avoid parsing the "Name" "Value" pairs to build a JSON request for the final REST Service but will have to build more than 1 REST method.

But hey, this is just my point of view.