Chilkat Online Tools

Node.js / Broker API / Announcements

Back to Collection Items

var os = require('os');
if (os.platform() == 'win32') {  
    if (os.arch() == 'ia32') {
        var chilkat = require('@chilkat/ck-node21-win-ia32');
    } else {
        var chilkat = require('@chilkat/ck-node21-win64'); 
    }
} else if (os.platform() == 'linux') {
    if (os.arch() == 'arm') {
        var chilkat = require('@chilkat/ck-node21-arm');
    } else if (os.arch() == 'x86') {
        var chilkat = require('@chilkat/ck-node21-linux32');
    } else {
        var chilkat = require('@chilkat/ck-node21-linux64');
    }
} else if (os.platform() == 'darwin') {
    if (os.arch() == 'arm64') {
        var chilkat = require('@chilkat/ck-node21-mac-m1');
    } else {
        var chilkat = require('@chilkat/ck-node21-macosx');
    }
}


function chilkatExample() {

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

    var http = new chilkat.Http();
    var success;

    http.BasicAuth = true;
    http.Login = "{{api_key}}";
    http.Password = "{{api_secret}}";

    var queryParams = new chilkat.JsonObject();
    queryParams.UpdateString("ca_types","dividend,merger,spinoff,split");
    queryParams.UpdateString("since","2021-12-01");
    queryParams.UpdateString("until","2021-12-17");

    // resp: HttpResponse
    var resp = http.QuickRequestParams("GET","https://domain.com/v1/corporate_actions/announcements",queryParams);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log(resp.StatusCode);
    console.log(resp.BodyStr);


}

chilkatExample();

Curl Command

curl -G -d "ca_types=dividend,merger,spinoff,split"
	-d "since=2021-12-01"
	-d "until=2021-12-17"
	-u '{{api_key}}:{{api_secret}}'
https://domain.com/v1/corporate_actions/announcements

Postman Collection Item JSON

{
  "name": "Announcements",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{HOST}}/v1/corporate_actions/announcements?ca_types=dividend,merger,spinoff,split&since=2021-12-01&until=2021-12-17",
      "host": [
        "{{HOST}}"
      ],
      "path": [
        "v1",
        "corporate_actions",
        "announcements"
      ],
      "query": [
        {
          "key": "ca_types",
          "value": "dividend,merger,spinoff,split",
          "description": "A comma-delimited list of ENUM.CorporateActionType values"
        },
        {
          "key": "since",
          "value": "2021-12-01",
          "description": "The start (inclusive) of the date range when searching corporate action announcements. This should follow the YYYY-MM-DD format. The date range is limited to 90 days."
        },
        {
          "key": "until",
          "value": "2021-12-17",
          "description": "The end (inclusive) of the date range when searching corporate action announcements. This should follow the YYYY-MM-DD format. The date range is limited to 90 days."
        },
        {
          "key": "symbol",
          "value": "",
          "description": "The symbol of the company initiating the announcement.",
          "disabled": true
        },
        {
          "key": "cusip",
          "value": "",
          "description": "The CUSIP of the company initiating the announcement.",
          "disabled": true
        },
        {
          "key": "date_type",
          "value": "",
          "description": "ENUM.DateType. Potential values are declaration_date, ex_date, record_date, or payable_date",
          "disabled": true
        }
      ]
    }
  },
  "response": [
  ]
}