/policyengine/v1/applications: POST

The /policyengine/v1/applications registers an action agent. Only an IBM Spectrum® Discover user with data admin role can register the application with IBM Spectrum Discover.

The following table shows which roles can access /policyengine/v1/applications endpoint:
Table 1. Access by role
Data admin Collection Admin Data user Admin Service user
X Χ Χ Χ

Synopsis of the request URL

curl -k -H “Authorization: Bearer <token>” -H "Content-Type: application/json" -X POST
https://<spectrum_discover_host>/policyengine/v1/applications 

Supported request types and response formats

Supported request types:
  • POST
Supported response formats:
  • JSON

Examples

Registering an application involves the following steps.
  1. Obtain an auth token by using credentials of the data admin user as shown in the following example:
    curl -k https://<spectrum_discover_host>/auth/v1/token -u “<user_name>:<password>

    For a valid user, the auth token is returned in the “X-Auth-Token” response header.

  2. Create a .json file with application details:
    cat agentregmsg.json
    {
    "action_agent": "extractapplication",
    "action_id": "deepinspect",
    "action_params": ["extract_tags"]
    }
    Note:
    • Only 'deepinspect' is supported as the valid 'action_id'
    • The 'action_agent' parameter needs to be maximum 64 characters long and can contain alpha-numeric characters and ‘.’, ‘_’ or ‘-’ characters.
    • Action parameters, when converted to string, can be maximum 256 characters long.
  3. Submit the following request:
    curl -k https://<spectrum_discover_host>/policyengine/v1/applications -H "Content-Type: application/json" -X POST -d @agentregmsg.json -H “Authorization: Bearer <token>”
    Note:
    • Only 'deepinspect' is supported as the valid 'action_id'.

      The 'action_agent' parameter can be up to 64 characters long and contain alpha-numeric characters and ‘.’, ‘_’ or ‘-’ characters.

      Action parameters can be up to 256 characters long when converted to string.

Response:
Content-Type: application/json
{
"broker_ip": 9.11.200.114,
"broker_port": 9093,
"work_q": "extractapplication_work",
"completion_q": "extractapplication_compl"
}

Multiple application instances

If you want to run multiple copies of an application, then only the first application registration attempt receives a success response. Any subsequent applications receive a 409 Conflict response. In such cases, use the /policyengine/v1/agents/<agent name> endpoint to find the required Kafka information to proceed.

Example GET response:
{
"broker_ip": "localhost",
"work_q": "extractapplication_work",
"auth": "extractapplication_user:extractapplication_password",
"params": "["tags"]",
"agent": "extractagent",
"broker_port": "9093",
"completion_q": "extractapplication_compl",
"action_id": "deepinspect"
}