This might be a simple one.
I'm accessing a RESTFul service with Delphi XE6 using RestClient components: TRestClient, TRestRequest, TRestResponse and THTTPBasicAuthenticator.
The service requires parameters which I have no problems adding:
RestReq.Params.AddItem('param1', 'value1');
RestReq.Params.AddItem('param2', 'value2');
With the above code on the server side it looks like:
{
"param1":"value1",
"param2":"value2"
}
However, when I need to send a parameter which is an array and I try:
RestReq.Params.AddItem('param1', 'value1');
RestReq.Params.AddItem('param2', 'value2');
RestReq.Params.AddItem('param3', '[v1, v2, v3]');
The service will reject it because the third parameter is not the expected array. Which is correct because it receives:
{
"param1":"value1",
"param2":"value2",
"param3":"[v1,v2,v3]"
}
I know it looks very simple. Have switched RestClient.ContentType, have tried to manipulate the array. Have tried changing the parameter ContentType, Options and guessing the solution is not a game I like to play.
So the question would be: Using the RestClient components ?how can I call my service with the following parameters?
{
"param1":"value1",
"param2":"value2",
"param3":[
"v1",
"v2",
"v3"
]
}
In advance, thanks for your time.
See Question&Answers more detail:
os