{
"ID": "2bdaad2e-e6f4-49d1-b737-e0276d8ccc03",
"name": "simple-config",
"metadata": {},
"secret_type": "Opaque",
"environment_id": "b1402013-b080-488d-858b-dadcb07a551a",
"data": null
}
Above JSON is the response from an HTTP client. We have an HTTP service and within that service, we call the above HTTP client and prepare a minimized response from the above JSON. The expected minimized response is,
{
"ID": "2bdaad2e-e6f4-49d1-b737-e0276d8ccc03",
"name": "simple-config"
}
Please find the relevant code below.
public type ResponseDto record {
string ID;
string name;
};
isolated resource function get () {
var httpClient = check getHttpClient();
string endpoint = string `/v1/external/api`;
var headers = utils:createHeaders(ctx);
json response = check httpClient->get(endpoint, headers, targetType = json);
ResponseDto res = check response.cloneWithType();
return res;
}
Still, I am getting full response and not getting the minimized response. How do I resolve this issue?