Agent Job
=========

get\_\ *agent_job*\ {agent_id}
------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/api/v14/agent/job/{agent_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/api/v14/agent/job/{agent_id}, headers = headers)

   print(r.json())

.. code:: javascript


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

   fetch(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id},
   {
     method: GET,

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

``GET /agent/job/{agent_id}``

Gets ``Jobs`` for agent level by agent_id.

Parameters
^^^^^^^^^^

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

  agent_id,path,integer,true,Agent ID
  X-Auth-Token,header,string,true,Token of authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   [
     {
       "jobname": "string",
       "jobenabled": true,
       "jobdesc": "string"
     }
   ]

.. 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 <Schemas>` ],false,none,none
  » jobname,string,false,none,Name of the job.
  » jobenabled,boolean,false,none,Determines whether the job is enabled or disabled.
  » jobdesc,string,false,none,Description of the job.

..  Note::
   This operation does not require authentication

post\_\ *agent_job*\ {agent_id}
-------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X POST https://PEM-SERVER-IP/api/v14/agent/job/{agent_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.post(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}, headers = headers)

   print(r.json())

.. code:: javascript

   const inputBody = {
     "jobname": "string",
     "jobenabled": true,
     "jobdesc": "string",
     "jsteps": [],
     "jschedules": [
       {
         "jscname": "string",
         "jscdesc": "string",
         "jscenabled": true,
         "jscstart": "2023-10-09 22:43 +05:30",
         "jscend": "2023-10-11 22:43 +05:30",
         "jscweekdays": "Monday",
         "jscmonthdays": 1,
         "jscmonths": "January",
         "jschours": 0,
         "jscminutes": 0,
         "jscexceptions": [
           {
             "jexdate": "2023-10-19",
             "jextime": "09:39:00"
           }
         ],
         "jsctimezone": "Asia/Calcutta"
       }
     ],
     "notify": "DEFAULT",
     "email_group_id": "string"
   };
   const headers = {
     Content-Type:application/json,
     Accept:application/json,
     X-Auth-Token:string
   };

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

``POST /agent/job/{agent_id}``

Creates ``Job`` for agent level.

**Body parameter**

.. code:: json

   {
     "jobname": "string",
     "jobenabled": true,
     "jobdesc": "string",
     "jsteps": [],
     "jschedules": [
       {
         "jscname": "string",
         "jscdesc": "string",
         "jscenabled": true,
         "jscstart": "2023-10-09 22:43 +05:30",
         "jscend": "2023-10-11 22:43 +05:30",
         "jscweekdays": "Monday",
         "jscmonthdays": 1,
         "jscmonths": "January",
         "jschours": 0,
         "jscminutes": 0,
         "jscexceptions": [
           {
             "jexdate": "2023-10-19",
             "jextime": "09:39:00"
           }
         ],
         "jsctimezone": "Asia/Calcutta"
       }
     ],
     "notify": "DEFAULT",
     "email_group_id": "string"
   }

.. _parameters-1:

Parameters
^^^^^^^^^^

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

  agent_id,path,integer,true,Agent ID
  X-Auth-Token,header,string,true,Token of authorization
  body,body,:ref:`AgentJobBodyPost<AgentJobBodyPost>` ,true,none

**Example responses**

.. raw:: html

   <Details summary="201 Response">

.. code:: json

   {
     "id": 0
   }

.. raw:: html

   </Details>

.. _responses-1:

Responses
^^^^^^^^^

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

  201, `Created <https://tools.ietf.org/html/rfc7231#section-6.3.2>`__ ,Created Successfully,Inline

.. _response-schema-1:

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

Status Code **201**

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

  » id,integer,false,none,Id of the job

..  Note::
   This operation does not require authentication

get\_\ *agent_job*\ {agent_id}\_{job_id}
----------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X GET https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_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/api/v14/agent/job/{agent_id}/{job_id}, headers = headers)

   print(r.json())

.. code:: javascript


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

   fetch(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id},
   {
     method: GET,

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

``GET /agent/job/{agent_id}/{job_id}``

Gets ``Jobs`` for agent level by agent_id and job_id.

.. _parameters-2:

Parameters
^^^^^^^^^^

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

  agent_id,path,integer,true,Agent ID
  job_id,path,integer,true,Job ID
  X-Auth-Token,header,string,true,Token of authorization

**Example responses**

.. raw:: html

   <Details summary="200 Response">

.. code:: json

   {
     "jobid": 0,
     "jobname": "string",
     "jobenabled": true,
     "jobdesc": "string",
     "jobcreated": "2019-08-24T14:15:22Z",
     "jobchanged": "2019-08-24T14:15:22Z",
     "jlgstatus": "string",
     "jobnextrun": "2019-08-24T14:15:22Z",
     "joblastrun": "2019-08-24T14:15:22Z",
     "is_alert_job": true,
     "notify": "string",
     "email_group_id": "string",
     "jsteps": [],
     "jschedules": [
       {
         "jscid": 0,
         "jscjobid": 0,
         "jscname": "string",
         "jscdesc": "string",
         "jscenabled": true,
         "jscstart": "2019-08-24T14:15:22Z",
         "jscend": "2019-08-24T14:15:22Z",
         "jscweekdays": [
           true
         ],
         "jscmonthdays": [
           true
         ],
         "jscmonths": [
           true
         ],
         "jschours": [
           true
         ],
         "jscminutes": [
           true
         ],
         "jscexceptions": [
           null
         ],
         "jsctimezone": "string"
       }
     ]
   }

.. 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:`AgentJobBodyGet<AgentJobBodyGet>` 

..  Note::
   This operation does not require authentication

put\_\ *agent_job*\ {agent_id}\_{job_id}
----------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X PUT https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id} \
     -H Content-Type: application/json \
     -H X-Auth-Token: string

.. code:: python

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

   r = requests.put(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id}, headers = headers)

   print(r.json())

.. code:: javascript

   const inputBody = {
     "jobname": "string",
     "jobenabled": true,
     "jobdesc": "string",
     "jsteps": {
       "added": [
         {
           "jstname": "string",
           "jstdesc": "string",
           "jstenabled": true,
           "jstkind": true,
           "jstcode": "string",
           "server_id": 0,
           "database_name": "string",
           "jstonerror": "f"
         }
       ],
       "changed": [
         {
           "jstid": 0,
           "jstname": "string",
           "jstdesc": "string",
           "jstenabled": true,
           "jstkind": true,
           "jstcode": "string",
           "server_id": 0,
           "database_name": "string",
           "jstonerror": "f",
           "jstnextrun": "string"
         }
       ]
     },
     "jschedules": {
       "added": [
         {
           "jscname": "string",
           "jscdesc": "string",
           "jscenabled": true,
           "jscstart": "2023-10-09 22:43 +05:30",
           "jscend": "2023-10-11 22:43 +05:30",
           "jscweekdays": "Monday",
           "jscmonthdays": 1,
           "jscmonths": "January",
           "jschours": 0,
           "jscminutes": 0,
           "jscexceptions": [
             {
               "jexdate": "2023-10-19",
               "jextime": "09:39:00"
             }
           ],
           "jsctimezone": "Asia/Calcutta"
         }
       ],
       "changed": [
         {
           "jscid": 0,
           "jscname": "string",
           "jscdesc": "string",
           "jscenabled": true,
           "jscstart": "2023-10-09 22:43 +05:30",
           "jscend": "2023-10-11 22:43 +05:30",
           "jscweekdays": "Monday",
           "jscmonthdays": 1,
           "jscmonths": "January",
           "jschours": 0,
           "jscminutes": 0,
           "jscexceptions": [
             {
               "jexdate": "2023-10-19",
               "jextime": "09:39:00"
             }
           ],
           "jsctimezone": "Asia/Calcutta"
         }
       ]
     },
     "notify": "DEFAULT",
     "email_group_id": "string"
   };
   const headers = {
     Content-Type:application/json,
     X-Auth-Token:string
   };

   fetch(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id},
   {
     method: PUT,
     body: inputBody,
     headers: headers
   })
   .then(function(res) {
       return res.json();
   }).then(function(body) {
       console.log(body);
   });

``PUT /agent/job/{agent_id}/{job_id}``

Updates ``Job`` for agent level.

**Body parameter**

.. code:: json

   {
     "jobname": "string",
     "jobenabled": true,
     "jobdesc": "string",
     "jsteps": {
       "added": [
         {
           "jstname": "string",
           "jstdesc": "string",
           "jstenabled": true,
           "jstkind": true,
           "jstcode": "string",
           "server_id": 0,
           "database_name": "string",
           "jstonerror": "f"
         }
       ],
       "changed": [
         {
           "jstid": 0,
           "jstname": "string",
           "jstdesc": "string",
           "jstenabled": true,
           "jstkind": true,
           "jstcode": "string",
           "server_id": 0,
           "database_name": "string",
           "jstonerror": "f",
           "jstnextrun": "string"
         }
       ]
     },
     "jschedules": {
       "added": [
         {
           "jscname": "string",
           "jscdesc": "string",
           "jscenabled": true,
           "jscstart": "2023-10-09 22:43 +05:30",
           "jscend": "2023-10-11 22:43 +05:30",
           "jscweekdays": "Monday",
           "jscmonthdays": 1,
           "jscmonths": "January",
           "jschours": 0,
           "jscminutes": 0,
           "jscexceptions": [
             {
               "jexdate": "2023-10-19",
               "jextime": "09:39:00"
             }
           ],
           "jsctimezone": "Asia/Calcutta"
         }
       ],
       "changed": [
         {
           "jscid": 0,
           "jscname": "string",
           "jscdesc": "string",
           "jscenabled": true,
           "jscstart": "2023-10-09 22:43 +05:30",
           "jscend": "2023-10-11 22:43 +05:30",
           "jscweekdays": "Monday",
           "jscmonthdays": 1,
           "jscmonths": "January",
           "jschours": 0,
           "jscminutes": 0,
           "jscexceptions": [
             {
               "jexdate": "2023-10-19",
               "jextime": "09:39:00"
             }
           ],
           "jsctimezone": "Asia/Calcutta"
         }
       ]
     },
     "notify": "DEFAULT",
     "email_group_id": "string"
   }

.. _parameters-3:

Parameters
^^^^^^^^^^

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

  agent_id,path,integer,true,Agent ID
  job_id,path,integer,true,Job ID
  X-Auth-Token,header,string,true,Token of authorization
  body,body,:ref:`AgentJobBodyPut<AgentJobBodyPut>` ,true,none

**Example responses**

.. _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>` ,Status 200,None

.. _response-schema-2:

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

..  Note::
   This operation does not require authentication

delete\_\ *agent_job*\ {agent_id}\_{job_id}
-------------------------------------------

**Code samples**

.. code:: shell


   #  You can also use wget

   curl -X DELETE https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id} \
     -H X-Auth-Token: string

.. code:: python

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

   r = requests.delete(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id}, headers = headers)

   print(r.json())

.. code:: javascript


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

   fetch(https://PEM-SERVER-IP/api/v14/agent/job/{agent_id}/{job_id},
   {
     method: DELETE,

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

``DELETE /agent/job/{agent_id}/{job_id}``

Deletes the ``Job`` using agent_id and job_id.

.. _parameters-4:

Parameters
^^^^^^^^^^

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

  agent_id,path,integer,true,Agent ID
  job_id,path,integer,true,Job ID
  X-Auth-Token,header,string,true,Token of 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>` ,Successful deletion,None

.. _response-schema-3:

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

..  Note::
   This operation does not require authentication
