Functions for invoking commands available on the Archicad JSON interface.
More...
Functions for invoking commands available on the Archicad JSON interface.
◆ ACAPI_Command_ExecuteJSONRequest()
GSErrCode ACAPI_Command_ExecuteJSONRequest |
( |
const GS::ObjectState & | commandRequest, |
|
|
GS::ObjectState & | commandResult ) |
Executes an Archicad JSON interface command.
- Since
- Archicad 29
- Parameters
-
commandRequest | [in] the command request to be executed. Must contain the "command" field, and must comply with the command schema definition. |
commandResult | [out] result of the executed command. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADNAME - No executable command was found with name given by the "command" field.
- APIERR_BADPARS - The object state request does not match the corresponding scheme definition.
- APIERR_GENERAL - An error occurred during the execution. The detailed description of the error can be obtained from the "error" field of
commandResult
.
- Example
void ACAPI_Command_ExecuteJSONRequest_Example ()
{
GS::ObjectState commandRequest ("command", "API.GetProductInfo");
GS::ObjectState commandResult;
if (err == NoError) {
const GS::ObjectState* result = commandResult.Get ("result");
if (result != nullptr) {
Int32 version, buildNumber;
result->Get ("version", version);
result->Get ("buildNumber", buildNumber);
ACAPI_WriteReport (
"API.GetProductInfo: \n- version: %d\n- build number: %d",
true, version, buildNumber);
}
}
}
Also refer to the AddOnCommand_Test example project of the API Development Kit.
◆ ACAPI_Command_GetHttpConnectionPort()
GSErrCode ACAPI_Command_GetHttpConnectionPort |
( |
UShort * | portNumber | ) |
|
Returns the HTTP port number, on which Archicad is expecting requests.
- Parameters
-
portNumber | [out] HTTP port number. |
- Returns
- NoError - The function has completed with success.
- APIERR_BADPARS - the portNumber parameter is nullptr.
- APIERR_GENERAL - there is an internal error and the HTTP server could not be started.