Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject queryParams;
HCkHttpResponse resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
CkHttp_putBasicAuth(http,TRUE);
CkHttp_putLogin(http,"{{api_key}}");
CkHttp_putPassword(http,"{{api_secret}}");
queryParams = CkJsonObject_Create();
CkJsonObject_UpdateString(queryParams,"ca_types","dividend,merger,spinoff,split");
CkJsonObject_UpdateString(queryParams,"since","2021-12-01");
CkJsonObject_UpdateString(queryParams,"until","2021-12-17");
resp = CkHttp_QuickRequestParams(http,"GET","https://domain.com/v1/corporate_actions/announcements",queryParams);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
return;
}
printf("%d\n",CkHttpResponse_getStatusCode(resp));
printf("%s\n",CkHttpResponse_bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
}
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": [
]
}