Chilkat Online Tools

delphiDll / Trader v2 API / Account Configurations

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
json: HCkJsonObject;
sbRequestBody: HCkStringBuilder;
resp: HCkHttpResponse;

begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

http := CkHttp_Create();

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "max_margin_multiplier": 1.0
// }

json := CkJsonObject_Create();
CkJsonObject_UpdateNumber(json,'max_margin_multiplier','1.0');

CkHttp_SetRequestHeader(http,'Apca-Api-Secret-Key','{{APCA_API_SECRET_KEY}}');
CkHttp_SetRequestHeader(http,'Apca-Api-Key-Id','{{APCA_API_KEY_ID}}');

sbRequestBody := CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);

resp := CkHttp_PTextSb(http,'GET','https://domain.com/v2/account/configurations',sbRequestBody,'utf-8','application/json',False,False);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add(IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
CkHttpResponse_Dispose(resp);

CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);

Curl Command

curl -X GET
	-H "Apca-Api-Key-Id: {{APCA_API_KEY_ID}}"
	-H "Apca-Api-Secret-Key: {{APCA_API_SECRET_KEY}}"
	-d '{
  "max_margin_multiplier": 1.0
}'
https://domain.com/v2/account/configurations

Postman Collection Item JSON

{
  "name": "Account Configurations",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Apca-Api-Key-Id",
        "value": "{{APCA_API_KEY_ID}}",
        "type": "text"
      },
      {
        "key": "Apca-Api-Secret-Key",
        "value": "{{APCA_API_SECRET_KEY}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"max_margin_multiplier\": 1.0\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{HOST}}/v2/account/configurations",
      "host": [
        "{{HOST}}"
      ],
      "path": [
        "v2",
        "account",
        "configurations"
      ]
    }
  },
  "response": [
  ]
}