/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:
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
- JSON
Examples
Registering an application involves the following steps.
- 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. - Create a .json file with application details:
cat agentregmsg.json { "action_agent": "extractapplication", "action_id": "DEEPINSPECT", "action_params": ["extract_tags"] }
Note: OnlyDEEPINSPECT
is supported as a validaction_id
and must always be in upper case. Theaction_agent
parameter must be a maximum of 64 characters long and can contain alpha-numeric characters and ‘.’, ‘_’ or ‘-’ characters. However, the action parameters that are converted to string can be a maximum of 256 characters long. - 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>”
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\""
}