Profiles
========

Manage Profiles API: create, list, update, publish/rollback drafts, and
reassign/delete profiles for servers and agents.

get\_\ *profiles*
-----------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/pem/api/v16/profiles/ \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.get(https://PEM-SERVER-IP/pem/api/v16/profiles/, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/,
   {
     method: GET,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``GET /profiles/``

- List profiles\*

Returns a summary list of published profiles only. If a draft exists for
a published profile, the item shows that profile’s ID and ‘published’ is
false. The response does not include ‘target_probe_configs’ or
‘target_alert_configs’.

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  X-Auth-Token,header,string,true,Token for authentication purpose

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   [
     {
       "id": 34,
       "name": "Production Agents",
       "description": "Monitoring production agents",
       "target_kind": "a",
       "active_assignments": 0,
       "published": true
     }
   ]

.. raw:: html

   </Details>

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,Inline

Response Schema
^^^^^^^^^^^^^^^

Status Code **200**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  *anonymous*,\ :ref:`Query information <Managing monitoring settings using profiles>` ],false,none,[A trimmed profile representation for list operations (no probe/alert config arrays).]
  » id,integer,false,none,none
  » name,string,false,none,none
  » description,string,false,none,none
  » target_kind,string,false,none,"Target type for the profile: 's' for server, 'a' for agent."
  » published,boolean,false,none,Convenience flag: true when status is 'published'.
  » active_assignments,integer,false,none,Count of active servers/agents assigned to this profile.

Enumerated Values
'''''''''''''''''

.. csv-table::
  :header: Property,Value
  :widths: 25,25
  :align: left
  :class: longtable

  target_kind,s
  target_kind,a

.. Note::
   This operation does not require authentication

post\_\ *profiles*
------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X POST https://PEM-SERVER-IP/pem/api/v16/profiles/ \
     -H Content-Type: application/json \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Content-Type: application/json,
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.post(https://PEM-SERVER-IP/pem/api/v16/profiles/, headers = headers)

   print(r.json())

.. code:: javascript

   const inputBody = {
     "name": "Production Servers",
     "description": "Monitoring production database servers",
     "target_kind": "s"
   };
   const headers = {
     Content-Type:application/json,
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/,
   {
     method: POST,
     body: inputBody,
     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``POST /profiles/``

- Create a new profile\*

Creates a new profile with the specified name (required), description
(optional), and target_kind (optional, defaults to ‘s’ for server).
Probes and auto-created alerts will be automatically created based on
target_kind.

**Body parameter**

.. code:: json

   {
     "name": "Production Servers",
     "description": "Monitoring production database servers",
     "target_kind": "s"
   }

.. _parameters-1:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  X-Auth-Token,header,string,true,Token for authorization
  body,body,object,false,none
  » name,body,string,true,Profile name (required)
  » description,body,string,false,Profile description (optional)
  » target_kind,body,string,false,"Target kind: 's' for server, 'a' for agent (optional, defaults to 's')"

.. _enumerated-values-1:

Enumerated Values
'''''''''''''''''

.. csv-table::
  :header: Parameter,Value
  :widths: 25,25
  :align: left
  :class: longtable

  » target_kind,s
  » target_kind,a

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "success": 0,
     "data": "string"
   }

.. raw:: html

   </Details>

.. _responses-1:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Profile created successfully,Inline
  400, `Bad Request <https://tools.ietf.org/html/rfc7231#section-6.5.1>`__ ,Bad request - missing required field 'name',None
  500, `Internal Server Error <https://tools.ietf.org/html/rfc7231#section-6.6.1>`__ ,Internal server error,None

.. _response-schema-1:

Response Schema
^^^^^^^^^^^^^^^

Status Code **200**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  » success,integer,false,none,none
  » data,string,false,none,none

.. Note::
   This operation does not require authentication

get\_\ *profiles*\ {profile_id}
-------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id} \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.get(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id},
   {
     method: GET,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``GET /profiles/{profile_id}``

- Get a profile by id\*

Returns a single profile with full probe and alert configurations. The
response includes a boolean ‘published’ field (true when the profile is
published).

.. _parameters-2:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "id": 0,
     "name": "string",
     "description": "string",
     "target_kind": "s",
     "published": true,
     "parent_id": 0,
     "draft_id": 0,
     "target_probe_configs": [
       {
         "probe_id": 0,
         "probe_name": "string",
         "enabled": true,
         "interval": 0,
         "lifetime": 0,
         "default_enabled": true,
         "default_interval": 0,
         "default_lifetime": 0,
         "target_type": 0,
         "force_enabled": true
       }
     ],
     "target_alert_configs": [
       {
         "id": 0,
         "alert_name": "string",
         "alert_template": 0,
         "description": "string",
         "enabled": true,
         "history_retention": 0,
         "frequency_min": 0,
         "auto_created": true,
         "template_id": "string",
         "params": [],
         "param_names": [
           "string"
         ],
         "param_types": "string",
         "params_units": [
           "string"
         ],
         "threshold_unit": "string",
         "operator": "string",
         "low_threshold_value": 0,
         "medium_threshold_value": 0,
         "high_threshold_value": 0,
         "send_email": true,
         "all_alert_enable": true,
         "email_group_id": 0,
         "low_alert_enable": true,
         "low_email_group_id": 0,
         "med_alert_enable": true,
         "med_email_group_id": 0,
         "high_alert_enable": true,
         "high_email_group_id": 0,
         "send_trap": true,
         "snmp_trap_version": 0,
         "low_send_trap": true,
         "med_send_trap": true,
         "high_send_trap": true,
         "cleared_alert_enable": true,
         "execute_script": true,
         "execute_script_on_clear": true,
         "execute_script_on_pem_server": true,
         "script_code": "string",
         "submit_to_nagios": true,
         "override_default_config": true,
         "send_notification": true,
         "low_webhook_ids": [
           0
         ],
         "med_webhook_ids": [
           0
         ],
         "high_webhook_ids": [
           0
         ],
         "cleared_webhook_ids": [
           0
         ]
       }
     ]
   }

..

   Profile not found

.. code:: json

   {
     "message": "Not found"
   }

.. raw:: html

   </Details>

.. _responses-2:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,:ref:`Upgrading SQL Profiler<Upgrading SQL Profiler>` 
  404, `Not Found <https://tools.ietf.org/html/rfc7231#section-6.5.4>`__ ,Profile not found,Inline

.. _response-schema-2:

Response Schema
^^^^^^^^^^^^^^^

Status Code **404**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  » message,string,false,none,none

.. Note::
   This operation does not require authentication

put\_\ *profiles*\ {profile_id}
-------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X PUT https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id} \
     -H Content-Type: application/json \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Content-Type: application/json,
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.put(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}, headers = headers)

   print(r.json())

.. code:: javascript

   const inputBody = {
     "name": "Production Servers (v2)",
     "description": "Tightened thresholds and probe intervals.",
     "target_probe_configs": {
       "changed": [
         {
           "probe_id": 7,
           "execution_frequency": 5,
           "lifetime": 60
         },
         {
           "probe_id": 15,
           "enabled": true,
           "execution_frequency": 10,
           "lifetime": 30
         }
       ]
     },
     "target_alert_configs": {
       "changed": [
         {
           "id": 101,
           "enabled": true,
           "frequency_min": 2
         },
         {
           "id": 102,
           "operator": ">",
           "low_threshold_value": 70,
           "medium_threshold_value": 85,
           "high_threshold_value": 95
         }
       ],
       "added": [
         {
           "alert_name": "Replication Lag",
           "alert_template": 18,
           "enabled": true,
           "history_retention": 30,
           "frequency_min": 5,
           "operator": ">",
           "medium_threshold_value": 60,
           "high_threshold_value": 120
         }
       ],
       "deleted": [
         {
           "id": 103
         }
       ]
     }
   };
   const headers = {
     Content-Type:application/json,
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id},
   {
     method: PUT,
     body: inputBody,
     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``PUT /profiles/{profile_id}``

- Update a profile by id\*

Update a single profile identified by ‘profile_id’. Use
‘name’/‘description’ for metadata. For probes, use
‘target_probe_configs.changed’ to modify existing probe configs only
(keys: probe_id, enabled?, enabled_by_default?, execution_frequency?,
lifetime?; also accepts legacy ‘use_default_enabled’ and ‘interval’).
Adding probes via this endpoint is not supported. For alerts, use
‘target_alert_configs’ with changed/added/deleted (deleted accepts
objects with only ‘id’).

**Body parameter**

.. code:: json

   {
     "name": "Production Servers (v2)",
     "description": "Tightened thresholds and probe intervals.",
     "target_probe_configs": {
       "changed": [
         {
           "probe_id": 7,
           "execution_frequency": 5,
           "lifetime": 60
         },
         {
           "probe_id": 15,
           "enabled": true,
           "execution_frequency": 10,
           "lifetime": 30
         }
       ]
     },
     "target_alert_configs": {
       "changed": [
         {
           "id": 101,
           "enabled": true,
           "frequency_min": 2
         },
         {
           "id": 102,
           "operator": ">",
           "low_threshold_value": 70,
           "medium_threshold_value": 85,
           "high_threshold_value": 95
         }
       ],
       "added": [
         {
           "alert_name": "Replication Lag",
           "alert_template": 18,
           "enabled": true,
           "history_retention": 30,
           "frequency_min": 5,
           "operator": ">",
           "medium_threshold_value": 60,
           "high_threshold_value": 120
         }
       ],
       "deleted": [
         {
           "id": 103
         }
       ]
     }
   }

.. _parameters-3:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization
  body,body,object,true,none
  » name,body,string,false,New name for the profile (optional).
  » description,body,string,false,New description/notes for the profile (optional).
  » target_probe_configs,body,:ref:`ProbeConfigsUpdateOnly<ProbeConfigsUpdateOnly>` ,false,Delta for probe configs when updating by profile id: only modify existing probes using 'changed'. Adding probes is not supported via this endpoint.
  »» changed,body,\ :ref:`Query information <Schemas>` ],false,Existing probe configs to modify (identified by probe_id).
  »»» probe_id,body,integer,true,Probe identifier to add/update.
  »»» enabled,body,boolean,false,Enable/disable this probe in the profile.
  »»» enabled_by_default,body,boolean,false,Whether the probe follows default enablement. Alias: 'use_default_enabled' accepted.
  »»» execution_frequency,body,integer,false,Probe execution frequency in minutes. Alias: 'interval' accepted.
  »»» lifetime,body,integer,false,History retention (days).
  » target_alert_configs,body,:ref:`AlertConfigsDelta<AlertConfigsDelta>` ,false,Delta for alert configs within a profile.
  »» changed,body,[allOf],false,Modify existing alerts.
  »»» id,body,integer,false,Alert ID to modify.
  »»» name,body,string,false,Alert name.
  »»» enabled,body,boolean,false,none
  »»» history_retention,body,integer,false,none
  »»» frequency_min,body,integer,false,none
  »»» operator,body,string,false,none
  »»» low_threshold_value,body,number,false,none
  »»» medium_threshold_value,body,number,false,none
  »»» high_threshold_value,body,number,false,none
  »»» all_alert_enable,body,boolean,false,none
  »»» email_group_id,body,integer,false,none
  »»» low_alert_enable,body,boolean,false,none
  »»» low_email_group_id,body,integer,false,none
  »»» med_alert_enable,body,boolean,false,none
  »»» med_email_group_id,body,integer,false,none
  »»» high_alert_enable,body,boolean,false,none
  »»» high_email_group_id,body,integer,false,none
  »» added,body,\ :ref:`Query information <Schemas>` ],false,Add new alerts. See AlertPayload for required fields.
  »»» alert_name,body,string,false,Name of the alert. NOTE: This property is a mandatory parameter for a POST request.
  »»» alert_template,body,integer,false,ID of the alert template. The ID must be a positive integer value. NOTE: This property is a mandatory parameter for a POST request.
  »»» description,body,string,false,none
  »»» enabled,body,boolean,false,Defines whether this alert is enabled/disabled. NOTE: This property is a mandatory parameter for a POST request.
  »»» history_retention,body,integer,false,Specifies how many days to keep the history of this alert. Possible values are from 1 to 99999. NOTE: This property is a mandatory parameter for a POST request.
  »»» frequency_min,body,integer,false,Defines how frequently (in minutes) the alert must be checked on PEM database server. Possible values are 1 to 65534. NOTE: This property is a mandatory parameter for a POST request.
  »»» operator,body,string,false,"Defines the operator for checking threshold values. Valid string are "">"" and ""&lt;"". NOTE: This property is a mandatory parameter for the POST request."
  »»» low_threshold_value,body,number,false,Threshold value for triggering the low alert. This property can be any valid integer/float value. NOTE: It is a mandatory parameter for a POST request.
  »»» medium_threshold_value,body,number,false,Threshold value for triggering the medium alert. This property can be any valid integer/float value. NOTE: It is a mandatory parameter for a POST request.
  »»» high_threshold_value,body,number,false,Threshold value for triggering the high alert. This property can be any valid integer/float value. NOTE: It is a mandatory parameter for a POST request.
  »»» all_alert_enable,body,boolean,false,Determines whether to send an email notification to the group specified by the parameter 'email_group_id' when the state of the alert changes.
  »»» email_group_id,body,integer,false,"Defines the email group to which email notification are sent, when the state of the alert changes."
  »»» low_alert_enable,body,boolean,false,Determines whether to send an email notification to the group specified by the parameter 'low_email_group_id' when the state of the alert is set to LOW.
  »»» low_email_group_id,body,integer,false,Defines the email group to which email notifications are sent when the state of the alert changes to LOW.
  »»» med_alert_enable,body,boolean,false,Determines whether to send an email notification to the group specified by the parameter 'medium_email_group_id' when the state of the alert is set to MEDIUM.
  »»» med_email_group_id,body,integer,false,Defines the email group to which email notifications are sent when the state of the alert changes to MEDIUM.
  »»» high_alert_enable,body,boolean,false,Determines whether to send an email notification to the group specified by the parameter 'high_email_group_id' when the state of the alert is set to HIGH.
  »»» high_email_group_id,body,integer,false,Defines the email group to which email notification are sent when the state of the alert changes to HIGH.
  »»» send_trap,body,boolean,false,Determines whether to send an SNMP trap notification when the state of the alert changes.
  »»» snmp_trap_version,body,integer,false,"Defines the SNMP trap version. Supported SNMP trap versions are 1, 2 or 3."
  »»» low_send_trap,body,boolean,false,Determines whether to send SNMP trap notifications when the state of the alert changes to LOW.
  »»» med_send_trap,body,boolean,false,Determines whether to send SNMP trap notifications when the state of the alert changes to MEDIUM.
  »»» high_send_trap,body,boolean,false,Determines whether to send SNMP trap notifications when the state of the alert chagnes to HIGH.
  »»» cleared_alert_enable,body,boolean,false,Determines whether to mute the notification for 'clear alert'.
  »»» params,body,\ :ref:`Query information <Schemas>` ],false,List of parameter/value pairs to be used by the alert template for checking alerts. NOTE: The alert template requires the all parameter to be defined.
  »»»» paramname,body,string,false,Name of the parameter. NOTE: This property must present on the alert template parameter list.Example:
  »»»» paramvalue,body,string,false,Value for the given parameter
  »»» execute_script,body,boolean,false,Determines whether to execute the provided script if the state of the alert changes to LOW/MEDIUM/HIGH.
  »»» execute_script_on_clear,body,boolean,false,Determines whether to execute the provided script if the state of the alert clears.
  »»» execute_script_on_pem_server,body,boolean,false,Determines whether to execute the provided script on the PEM host or the host where the agent is monitoring the object.
  »»» script_code,body,string,false,The shell or batch script to be executed. Please read the documentation for detailed information.
  »»» submit_to_nagios,body,boolean,false,"Defines whether to send notification to the nagios, when state of the alert is chagned."
  »»» override_default_config,body,boolean,false,Determines whether to override the default webhook configuration.
  »»» send_notification,body,boolean,false,Determines whether the webhook send notification is enabled.
  »»» low_webhook_ids,body,[integer],false,Defines webhook IDs for which low alerts can be configured.
  »»» med_webhook_ids,body,[integer],false,Defines webhook IDs for which medium alerts can be configured.
  »»» high_webhook_ids,body,[integer],false,Defines webhook IDs for which high alerts can be configured.
  »»» cleared_webhook_ids,body,[integer],false,Defines webhook IDs for which cleared alerts can be configured.
  »» deleted,body,\ :ref:`Query information <Schemas>` ],false,Delete existing alerts by id.
  »»» id,body,integer,true,Alert config id to delete.

.. _enumerated-values-2:

Enumerated Values
'''''''''''''''''

.. csv-table::
  :header: Parameter,Value
  :widths: 25,25
  :align: left
  :class: longtable

  »»» operator,>
  »»» operator,&lt;
  »»»» paramname,Exclude tables smaller than
  »»»» paramname,mount point
  »»»» paramname,Host IP Address
  »»»» paramname,Time interval to monitor
  »»»» paramname,Time since idle
  »»»» paramname,Per CPU utilization (K%)

**Example responses**

.. raw:: html

   <Details summary="Invalid JSON body">

.. code:: json

   {
     "message": "Invalid JSON body"
   }

.. raw:: html

   </Details>

.. _responses-3:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Profile updated successfully,None
  400, `Bad Request <https://tools.ietf.org/html/rfc7231#section-6.5.1>`__ ,Invalid JSON body,None

.. _response-schema-3:

Response Schema
^^^^^^^^^^^^^^^

.. Note::
   This operation does not require authentication

delete\_\ *profiles*\ {profile_id}
----------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X DELETE https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id} \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     X-Auth-Token: string
   }

   r = requests.delete(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id},
   {
     method: DELETE,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``DELETE /profiles/{profile_id}``

- Delete a profile\*

.. _parameters-4:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. _responses-4:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Profile deleted successfully,None

.. _response-schema-4:

Response Schema
^^^^^^^^^^^^^^^

.. Note::
   This operation does not require authentication

get\_\ *profiles*\ {profile_id}_assigned
----------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/assigned \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.get(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/assigned, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/assigned,
   {
     method: GET,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``GET /profiles/{profile_id}/assigned``

- Get servers and agents assigned to a profile\*

.. _parameters-5:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "servers": [
       "string"
     ],
     "agents": [
       "string"
     ]
   }

.. raw:: html

   </Details>

.. _responses-5:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,Inline

.. _response-schema-5:

Response Schema
^^^^^^^^^^^^^^^

Status Code **200**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  » servers,[string],false,none,none
  » agents,[string],false,none,none

.. Note::
   This operation does not require authentication

get\_\ *profiles*\ {profile_id}_draft
-------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/draft \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.get(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/draft, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/draft,
   {
     method: GET,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``GET /profiles/{profile_id}/draft``

- Get a draft by profile id\*

Returns the draft profile associated with the given published profile
id, including full probe and alert configurations. The response does not
include parent_id or draft_id fields.

.. _parameters-6:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "id": 0,
     "name": "string",
     "description": "string",
     "target_kind": "s",
     "published": true,
     "target_probe_configs": [
       {
         "probe_id": 0,
         "probe_name": "string",
         "enabled": true,
         "interval": 0,
         "lifetime": 0,
         "default_enabled": true,
         "default_interval": 0,
         "default_lifetime": 0,
         "target_type": 0,
         "force_enabled": true
       }
     ],
     "target_alert_configs": [
       {
         "id": 0,
         "alert_name": "string",
         "alert_template": 0,
         "description": "string",
         "enabled": true,
         "history_retention": 0,
         "frequency_min": 0,
         "auto_created": true,
         "template_id": "string",
         "params": [],
         "param_names": [
           "string"
         ],
         "param_types": "string",
         "params_units": [
           "string"
         ],
         "threshold_unit": "string",
         "operator": "string",
         "low_threshold_value": 0,
         "medium_threshold_value": 0,
         "high_threshold_value": 0,
         "send_email": true,
         "all_alert_enable": true,
         "email_group_id": 0,
         "low_alert_enable": true,
         "low_email_group_id": 0,
         "med_alert_enable": true,
         "med_email_group_id": 0,
         "high_alert_enable": true,
         "high_email_group_id": 0,
         "send_trap": true,
         "snmp_trap_version": 0,
         "low_send_trap": true,
         "med_send_trap": true,
         "high_send_trap": true,
         "cleared_alert_enable": true,
         "execute_script": true,
         "execute_script_on_clear": true,
         "execute_script_on_pem_server": true,
         "script_code": "string",
         "submit_to_nagios": true,
         "override_default_config": true,
         "send_notification": true,
         "low_webhook_ids": [
           0
         ],
         "med_webhook_ids": [
           0
         ],
         "high_webhook_ids": [
           0
         ],
         "cleared_webhook_ids": [
           0
         ]
       }
     ]
   }

..

   Draft not found for profile

.. code:: json

   {
     "message": "Not found"
   }

.. raw:: html

   </Details>

.. _responses-6:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Successful response,:ref:`ProfileDraft<ProfileDraft>` 
  404, `Not Found <https://tools.ietf.org/html/rfc7231#section-6.5.4>`__ ,Draft not found for profile,Inline

.. _response-schema-6:

Response Schema
^^^^^^^^^^^^^^^

Status Code **404**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  » message,string,false,none,none

.. Note::
   This operation does not require authentication

delete\_\ *profiles*\ {profile_id}_rollback
-------------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X DELETE https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/rollback \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     X-Auth-Token: string
   }

   r = requests.delete(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/rollback, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/rollback,
   {
     method: DELETE,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``DELETE /profiles/{profile_id}/rollback``

- Rollback draft for a profile\*

.. _parameters-7:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. _responses-7:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Draft deleted or no draft available,None

.. _response-schema-7:

Response Schema
^^^^^^^^^^^^^^^

.. Note::
   This operation does not require authentication

post\_\ *profiles*\ {profile_id}_publish
----------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X POST https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/publish \
     -H Accept: application/json \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     Accept: application/json,
     X-Auth-Token: string
   }

   r = requests.post(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/publish, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     Accept:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/publish,
   {
     method: POST,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``POST /profiles/{profile_id}/publish``

- Publish a profile\*

Publishes the draft for the given profile if present. Returns a message
indicating the profile is already published when no draft exists.

.. _parameters-8:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. raw:: html

   <Details summary="Profile not found">

.. code:: json

   {
     "message": "Not found"
   }

.. raw:: html

   </Details>

.. _responses-8:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Profile published successfully or already published,None
  404, `Not Found <https://tools.ietf.org/html/rfc7231#section-6.5.4>`__ ,Profile not found,Inline

.. _response-schema-8:

Response Schema
^^^^^^^^^^^^^^^

Status Code **404**

.. csv-table::
  :header: Name,Type,Required,Restrictions,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  » message,string,false,none,none

.. Note::
   This operation does not require authentication

delete\_\ *profiles*\ {profile_id}\_{new_profile_id}
----------------------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X DELETE https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/{new_profile_id} \
     -H X-Auth-Token: string

.. code:: python

   import requests
   headers = {
     X-Auth-Token: string
   }

   r = requests.delete(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/{new_profile_id}, headers = headers)

   print(r.json())

.. code:: javascript


   const headers = {
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/pem/api/v16/profiles/{profile_id}/{new_profile_id},
   {
     method: DELETE,

     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``DELETE /profiles/{profile_id}/{new_profile_id}``

- Delete a profile and reassign to new profile\*

.. _parameters-9:

Parameters
^^^^^^^^^^

.. csv-table::
  :header: Name,In,Type,Required,Description
  :widths: 12,8,8,8,12
  :align: left
  :class: longtable

  profile_id,path,integer,true,none
  new_profile_id,path,integer,true,none
  X-Auth-Token,header,string,true,Token for authorization

**Example responses**

.. _responses-9:

Responses
^^^^^^^^^

.. csv-table::
  :header: Status,Meaning,Description,Schema
  :widths: 15,12,12,20
  :align: left
  :class: longtable

  200,:ref:`Invoking the server installer from the command line<Invoking the server installer from the command line>` ,Profile deleted and reassigned successfully,None

.. _response-schema-9:

Response Schema
^^^^^^^^^^^^^^^

.. Note::
   This operation does not require authentication
