.. _arbitrator-API-resources-v2-lxt_updates:

``/v2/lxt_updates`` 
--------------------

	
.. tabularcolumns:: |p{1.5cm}|p{5cm}|p{8.5cm}|

+--------+--------------------------+--------------------------------------------------------+
| Method | URL                      | Description                                            |
+========+==========================+========================================================+
| GET    | ``/v2/lxt_updates``      | Retrieves current list of all update requests.         |
+--------+--------------------------+--------------------------------------------------------+
| GET    | ``/v2/lxt_updates/{id}`` | Retrieves information about a specific update request. |
+--------+--------------------------+--------------------------------------------------------+
| POST   | ``/v2/lxt_updates``      | Adds a new update request.                             |
+--------+--------------------------+--------------------------------------------------------+
| PUT    | ``/v2/lxt_updates``      | Modifies an existing update request.                   |
+--------+--------------------------+--------------------------------------------------------+
| PUT    | ``/v2/lxt_updates/{id}`` | Modifies an existing update request.                   |
+--------+--------------------------+--------------------------------------------------------+
| DELETE | ``/v2/lxt_updates``      | Deletes an existing update request.                    |
+--------+--------------------------+--------------------------------------------------------+
| DELETE | ``/v2/lxt_updates/{id}`` | Deletes an existing update request.                    |
+--------+--------------------------+--------------------------------------------------------+



Header (required)
...................
 
``x-lxt-api-token``: "token from login" 

GET 
.....

``/v2/lxt_updates``
  
  
* Example 1: Get All Updates

  Command: 
 
  ::
  
     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -X GET https://<IP or FQDN>/api/v2/lxt_updates
          
  Output (formatted): 

  ::

     { 
      "status":200,  
      "message":"Success",  
      "data":[ 
       {"id":"12"}, 
       {"id":"13"} 
      ] 
     }

  RESP_CODE: ``200``

* Example 2: Get Updates with specified id 


  Command: 

  ::

     curl -s 
     -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
     --insecure 
     -w "RESP_CODE: %{response_code}" 
     -X GET https://<IP or FQDN>/api/v2/lxt_updates/12 

  
  Output (formatted): 

  ::


     { 
       "status":200,  
       "message":"Success", 
       "data":[ 
         { 
         "id":"12", 
         "status":{"comment":"Error encountered. Please reference the install log."}, 
         "log":"This file does not look like a service pack.\n" 
         } 
       ] 
     
     }


   RESP_CODE: ``200``

POST 
......


Use POST to add a new update request. 

``/v2/lxt_updates``

* Input defines 

  The following definitions may be used when creating a new request. 
  The new software should be copied into the drop account, or else provide a URL for fetching. 

  ::

    id=12 (optional)  
    delay=60 (optional) 
    url=http://www.layerxtech.com/downloads/arbitratorhawaii/updates (optional) 

* Example 1: Add new update request 

  Command: 

  ::

     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -X POST https://<IP or FQDN>/api/v2/lxt_updates
        
  or

  ::

      curl -s 
           -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni[...]
           --insecure 
           -w "RESP_CODE: %{response_code}" 
           -d 'id=12' 
           -d 'delay=60' 
           -d 'url=http://www.layerxtech.com/downloads/arbitratorhawaii/updates' 
           -X POST https://<IP  or FQDN>/api/v2/lxt_updates 


  Output (formatted): 

  ::

     { 
      "status":200,  
      "message":"Success",  
      "data":[{"id":"12"}] 
     }


  RESP_CODE: ``200``

PUT
....

Use PUT to modify an existing update request. 
An error will be returned if the update request does not  exist in the system. 

``/v2/lxt_updates`` 

* Input defines
 
  The following definitions may be used when creating a new request.

  ::

    id=12 (optional) 
    delay=60 (optional) 
    url=http://www.layerxtech.com/downloads/arbitratorhawaii/updates (optional) 
  
* Example 1: Update existing update request 

  Command: 

  ::

     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -d'id=12&delay=0' 
          -X PUT https://<IP or  FQDN>/api/v2/lxt_updates 

  or 

  ::

      curl -s 
           -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
           --insecure
           -w "RESP_CODE: %{response_code}" 
           -d 'delay=0' 
           -X PUT https://<IP or FQDN>/api/v2/users/12 
           
 Output (formatted):

 ::

   { 
    "status":201,  
    "message":"Success",  
    "data":{ "id":"12" } 
    } 
 
 RESP_CODE: ``200``

  
DELETE
..........


``/v2/lxt_updates``

``/v2/lxt_updates/{id}``

*  Example 1: Delete existing update request 


   Command: 

   ::

      curl -s 
           -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
           --insecure 
           -w "RESP_CODE: %{response_code}" 
           -d"id=12" 
           -X DELETE https://<IP or FQDN>/api/v2/lxt_udpates 

   or 
 
   ::
 
     curl -s 
          -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
          --insecure 
          -w "RESP_CODE: %{response_code}" 
          -X DELETE https://<IP or FQDN>/api/v2/lxt_updates/12 
     
   Output (formatted):
  
   ::
  
      { 
      "status":201,  
      "message":"Success", 
      "data":[] 
      } 
  
    RESP_CODE: ``200``


  
* Example 2: Delete existing update request again 

  Command: 

  ::

    curl -s 
         -H x-lxt-apitoken:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
         --insecure 
         -w "RESP_CODE: %{response_code}" 
         -d"id=12" 
         -X DELETE https://<IP or FQDN>/api/v2/lxt_updates 
  
  or

  ::

    curl -s 
         -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...]
         --insecure 
         -w "RESP_CODE: %{response_code}" 
         -X DELETE https://<IP or FQDN>/api/v2/lxt_updates/12 
         
  Output (formatted):

  ::

    { 
      "status":404, 
      "message":"Could not find existing entry for {id}",  
      "data":[] 
    } 

  RESP_CODE: ``404``
