000021527 - How to generate custom reports via an API call in RSA ACE/Server 5.2 Administration API

Document created by RSA Customer Support Employee on Jun 16, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000021527
Applies ToRSA ACE/Server 5.2 Administration API
IssueHow to generate custom reports via an API call in RSA ACE/Server 5.2 Administration API
CauseThere are a variety of ways to generate reports from RSA ACE/Server. In some instances, it is useful to use the Administration API to generate report data (perhaps to be used in a larger application).
ResolutionThe follow sample code shows a very simple example of using RSA ACE/Server Administration API to generate report data:

#include "apiuser.h"
#define MAX_RESULT_MSG_SIZE 4097

    int error;
    char buffer[MAX_RESULT_MSG_SIZE];

    // Authentication routine using Sd_AdmLogin could go here

    // Connect to the local ACE/Server
    error = Sd_ApiInit("","","1", buffer, MAX_RESULT_MSG_SIZE);
    printf("ApiInit() result = %d, %s\n",error,buffer);

    // run our custom SQL query
    // In a real application many of these parameters would variables passed into the program

    error=Sd_DynamicSelect("c:\\myreport.csv", 0, 1, 0, 1, "query", "", "SELECT chDefaultLogin, chLastName, chFirstName, "
     "chSerialNum, dateLostStatusExpires, todLostStatusExpires, iLostAuthMethod FROM SDUser JOIN SDToken "
     "ON SDUser.iUserNum = SDToken.iUserNum WHERE SDToken.bLost = TRUE ORDER BY chDefaultLogin",
     "","","",buffer, MAX_RESULT_MSG_SIZE);
    printf("DynamicSelect() result = %d, %s\n",error,buffer);

    // Disconnect

    error = Sd_ApiEnd(buffer, MAX_RESULT_MSG_SIZE);
    printf("ApiEnd() result = %d, %s\n",error,buffer);
Legacy Article IDa23418