This project has retired. For details please refer to its Attic page.
Lens Server: SessionResource

SessionResource Resource

Session resource api

This provides api for all things in session.

GET /session

API to know if session service is up and running

Response Body
media type data type description
text/plain (custom) Simple text saying it up

Example

Request
GET /session
Accept: text/plain

              
Response
HTTP/1.1 200 OK
Content-Type: text/plain

                
...
                
              

POST /session

Create a new session with Lens server.

Request Parameters
name type description default
database formdata Set current database to the supplied value, if provided
password formdata Password of the Lens server user  
sessionconf formdata Key-value properties which will be used to configure this session  
username formdata User name of the Lens server user  
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json LensSessionHandle (JSON) A Session handle unique to this session
application/json LensSessionHandle (JSON)
application/xml lensSessionHandle (XML)
text/plain (custom)

Example

Request
POST /session
Accept: application/json

              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "publicId" : "...",
  "secretId" : "..."
}
                
              

DELETE /session

Close a Lens server session.

Request Parameters
name type description
sessionid query Session handle object of the session to be closed
Response Body
media type data type description
application/json APIResult (JSON) APIResult object indicating if the operation was successful (check result.getStatus())
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /session
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "PARTIAL",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

PUT /session/resources/add

Add a resource to the session to all LensServices running in this Lens server

The returned @{link APIResult} will have status SUCCEEDED only if the add operation was successful for all services running in this Lens server.

Request Parameters
name type description
path formdata path of the resource
sessionid formdata session handle object
type formdata The type of resource. Valid types are 'jar', 'file' and 'archive'
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json APIResult (JSON) APIResult with state Status#SUCCEEDED, if add was successful. APIResult with state Status#PARTIAL, if add succeeded only for some services. APIResult with state Status#FAILED, if add has failed
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
PUT /session/resources/add
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "SUCCEEDED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /session/resources/list

Lists resources from the session for a given resource type.

Request Parameters
name type description
sessionid query session handle object
type query resource type. It can be jar, file or null
Response Body
media type data type description
application/json StringList (JSON) Lists all resources for a given resource type Lists all resources if the resource type is not specified
application/json StringList (JSON)
application/xml stringList (XML)
text/plain (custom)

Example

Request
GET /session/resources/list
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "elements" : [ [ "...", "..." ], [ "...", "..." ] ]
}
                
              

PUT /session/resources/delete

Delete a resource from sesssion from all the @{link LensService}s running in this Lens server

Similar to addResource, this call is successful only if resource was deleted from all services.

Request Parameters
name type description
path formdata path of the resource to be deleted
sessionid formdata session handle object
type formdata The type of resource. Valid types are 'jar', 'file' and 'archive'
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json APIResult (JSON) APIResult with state Status#SUCCEEDED, if delete was successful. APIResult with state Status#PARTIAL, if delete succeeded only for some services. APIResult with state Status#FAILED, if delete has failed
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
PUT /session/resources/delete
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "SUCCEEDED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /session/params

Get a list of key=value parameters set for this session.

Request Parameters
name type description default constraints
key query if this is empty, output will contain all parameters and their values, if it is non empty parameters will be filtered by key  
sessionid query session handle object    
verbose query If true, all the parameters will be returned. If false, configuration parameters will be returned false boolean
Response Body
media type data type description
application/json StringList (JSON) List of Strings, one entry per key-value pair
application/json StringList (JSON)
application/xml stringList (XML)
text/plain (custom)

Example

Request
GET /session/params
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "elements" : [ [ "...", "..." ], [ "...", "..." ] ]
}
                
              

PUT /session/params

Set value for a parameter specified by key

The parameters can be a hive variable or a configuration. To set key as a hive variable, the key should be prefixed with 'hivevar:'. To set key as configuration parameter, the key should be prefixed with 'hiveconf:' If no prefix is attached, the parameter is set as configuration.

Request Parameters
name type description
key formdata parameter key
sessionid formdata session handle object
value formdata parameter value
Response Body
media type data type description
application/json APIResult (JSON) APIResult object indicating if set operation was successful
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
PUT /session/params
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "SUCCEEDED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /session/sessions

Returns a list of all sessions

Response Body
media type data type
application/json array of array of UserSessionInfo (JSON)
application/json array of array of UserSessionInfo (JSON)
application/xml list of userSessionInfo (XML)
text/plain (custom)

Example

Request
GET /session/sessions
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "handle" : "...",
  "userName" : "...",
  "activeQueries" : [ [ {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  }, {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  } ], [ {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  }, {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  } ] ],
  "creationTime" : 12345,
  "lastAccessTime" : 12345
}
                
              

DELETE /session/sessions

Clears idle sessions. response will contain how many sessions were cleared.

Response Body
media type data type
application/json APIResult (JSON)
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /session/sessions
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "FAILED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}