Perform an Action
A command object (type ACI_COMMAND
) stores information about the action that you want to run, as well as all the parameters that this action requires, such as:
-
the type of HTTP request (GET/POST) that is made when the action runs.
-
security details for a data repository.
There is no limit to the number of parameters that can be stored, but there can only be one action.
Create an Action
The following example shows how to create a command object.
// Always need to call aciInit at start of any program using ACI client lib aciInit(); // Create the command object t_aciObject* pCommand = NULL; aciObjectCreate(&pCommand, ACI_COMMAND); // Set command to execute aciObjectParamSetString(pCommand, ACI_COM_COMMAND, "QUERY"); // Set http method aciObjectParamSetBool(pCommand, ACI_COM_USE_POST,TRUE); // Set action parameters aciObjectParamSetString( pCommand, "Text", "Reducing heart attack risk"); aciObjectParamSetString(pCommand, "LanguageType", "English"); aciObjectParamSetBool(pCommand, "TotalResults", TRUE); // Create security string aciObjectSetUserSecurityInfo(pCommand, "notes", ACI_SECURITY_USERNAME, "jbloggs"); aciObjectSetUserSecurityInfo( pCommand, "notes", ACI_SECURITY_GROUP, "techusers");