I use the following script to request data from an API. This works fine, but only if the response does not exceed a certain size (~200 lines), otherwise I get an "Error reading Data from Socket" exception back. Anybody got an idea?
UPDATE:
I tried Indy's idhttp, it works fine here. So it is not because of an API error, the server or something else.
url := APIUrl+'/positions'; //HTTPS-URL
GetJson := TJSONObject.Create;
With TFPHttpClient.Create(Nil) do
try
AddHeader('Content-Type', 'application/json; charset=UTF-8');
AddHeader('Accept', 'application/json; charset=UTF-8');
AddHeader('VERSION', '2');
AddHeader('X-API-KEY', APIKey);
AddHeader('X-SECURITY-TOKEN',token);
AddHeader('CST', cst);
RequestBody := TStringStream.Create(GetJson.AsJSON);
responseData := Get(url);
finally
Free;
end;
memo1.lines.text:=responseData;