{
    "swagger":"2.0",
    "info":{
        "title":"REST API for Session Management in Oracle Access Manager",
        "description":"The Oracle Access Manager Session Management REST APIs enable you to manage users' sessions. Session details can be retrieved using session IDs or based on the search query details provided in the filter.",
        "version":"2024.01.17",
        "x-summary":"The Oracle Access Manager Session Management REST APIs enable you to manage users' sessions."
    },
    "schemes":[
        "https"
    ],
    "basePath":"/oam/services/rest/access/api/v1",
    "produces":[
        "application/json"
    ],
    "paths":{
        "/sessions":{
            "post":{
                "summary":"Retrieve Sessions based on provided query filter",
                "description":"The sessions endpoint returns information about the sessions.\nThe response includes sessionId, user name, Identity Store, session create date, \nip address and other details about each session..\n",
                "parameters":[
                    {
                        "name":"sessionId",
                        "in":"query",
                        "description":"Session Id of the session if single session is to be queried.",
                        "required":false,
                        "type":"string"
                    },
                    {
                        "name":"userId",
                        "in":"query",
                        "description":"User login id of the user, whose sessions are to be searched.",
                        "required":false,
                        "type":"string"
                    },
                    {
                        "name":"idStore",
                        "in":"query",
                        "description":"Identity Store name for the users, whose sessions are to be searched.",
                        "required":false,
                        "type":"string"
                    },
                    {
                        "name":"sessionSearchQuery",
                        "in":"body",
                        "description":"Detailed query criterion for searching the sessions.",
                        "required":false,
                        "schema":{
                            "$ref":"#/definitions/SessionSearchQuery"
                        }
                    }
                ],
                "tags":[
                    "Sessions"
                ],
                "responses":{
                    "200":{
                        "description":"A session result object that contains an array of sessions with maximum of 28 sessions is returned. It also contains other summary information.",
                        "schema":{
                            "$ref":"#/definitions/SessionResults"
                        }
                    },
                    "401":{
                        "description":"Unauthorized"
                    },
                    "404":{
                        "description":"Requested Data Not found"
                    },
                    "500":{
                        "description":"Internal Server Error",
                        "schema":{
                            "$ref":"#/definitions/Error"
                        }
                    }
                },
                "x-internal-id":"sessions-post",
                "x-filename-id":"sessions-post"
            }
        },
        "/session/{sessionId}":{
            "get":{
                "summary":"Gets a session whose session id is provided in the path",
                "description":"Gets a session by sessionId.",
                "parameters":[
                    {
                        "name":"sessionId",
                        "in":"path",
                        "type":"string",
                        "description":"sessionId for the session. This string value needs to be http encoded.",
                        "required":true
                    }
                ],
                "tags":[
                    "Session"
                ],
                "responses":{
                    "200":{
                        "description":"SessionData Object is returned if session is found.",
                        "schema":{
                            "$ref":"#/definitions/SessionData"
                        }
                    },
                    "401":{
                        "description":"Unauthorized"
                    },
                    "404":{
                        "description":"Users OAM Session not found"
                    },
                    "408":{
                        "description":"Session that was being retrieved has timed out"
                    },
                    "500":{
                        "description":"Internal Server Error",
                        "schema":{
                            "$ref":"#/definitions/Error"
                        }
                    }
                },
                "x-internal-id":"session-{sessionId}-get",
                "x-filename-id":"session-sessionid-get"
            }
        },
        "/session":{
            "post":{
                "summary":"Create a session",
                "description":"This method creates a session for the user. Default values are used if none other than userId are provided. UserId is a mandatory parameter.",
                "parameters":[
                    {
                        "name":"sessionData",
                        "in":"body",
                        "description":"Detailed query criterion for searching the sessions.",
                        "required":true,
                        "schema":{
                            "$ref":"#/definitions/SessionData"
                        }
                    }
                ],
                "tags":[
                    "Session"
                ],
                "responses":{
                    "200":{
                        "description":"Created session is returned in the response.",
                        "schema":{
                            "$ref":"#/definitions/SessionData"
                        }
                    },
                    "400":{
                        "description":"Bad Request. Error in input Data."
                    },
                    "404":{
                        "description":"Not Found. Session creation had no errors, but created session could not be reqrieved/found."
                    },
                    "500":{
                        "description":"Unexpected error",
                        "schema":{
                            "$ref":"#/definitions/Error"
                        }
                    }
                },
                "x-internal-id":"session-post",
                "x-filename-id":"session-post"
            },
            "delete":{
                "summary":"Delete session(s) based on query parameters provided.",
                "description":"This api / method can be used to delete sessions based on session id, userid or all sessions belonging to id store.",
                "parameters":[
                    {
                        "name":"sessionId",
                        "in":"query",
                        "type":"string",
                        "description":"Id of the session which is to be deleted. If this parameter is present then other query parameters are ignored.",
                        "required":false
                    },
                    {
                        "name":"userId",
                        "in":"query",
                        "type":"string",
                        "description":"User Id (loginid) of the user whose sessions are to be deleted. This parameter is used if sessionId is not provided. If this parameter is provied then idStoreParameter is also used if provided."
                    },
                    {
                        "name":"idStore",
                        "in":"query",
                        "type":"string",
                        "description":"idStore to which user belongs. This parameter is used on conjunction with the userId parameter. If userId parameter is not provided then this parameter is ignored."
                    }
                ],
                "tags":[
                    "Session"
                ],
                "responses":{
                    "200":{
                        "description":"An array of sessions that were deleted (with maximum of 28 sessions) is returned.",
                        "schema":{
                            "type":"array",
                            "items":{
                                "$ref":"#/definitions/SessionData"
                            }
                        }
                    },
                    "404":{
                        "description":"Session or user was not found. Or sessionId or userId was not provided."
                    },
                    "500":{
                        "description":"Unexpected error",
                        "schema":{
                            "$ref":"#/definitions/Error"
                        }
                    }
                },
                "x-internal-id":"session-delete",
                "x-filename-id":"session-delete"
            }
        }
    },
    "definitions":{
        "NameValueAttribute":{
            "type":"object",
            "properties":{
                "attrName":{
                    "type":"string",
                    "description":"Attribute Name"
                },
                "attrValue":{
                    "type":"string",
                    "description":"Attribute Value"
                }
            }
        },
        "UserAttributes":{
            "description":"Collection of Name Value pair attributes",
            "properties":{
                "default":{
                    "$ref":"#/definitions/NameValueAttribute"
                }
            },
            "additionalProperties":{
                "$ref":"#/definitions/NameValueAttribute"
            }
        },
        "Sessions":{
            "description":"Collections of SessionData Objects.",
            "properties":{
                "default":{
                    "$ref":"#/definitions/SessionData"
                },
                "additionalProperties":{
                    "$ref":"#/definitions/SessionData"
                }
            }
        },
        "SessionSearchQuery":{
            "type":"object",
            "properties":{
                "sessionId":{
                    "type":"string",
                    "description":"Session Identifier for querying the session."
                },
                "updateTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Update Time query filter."
                },
                "lastAccessTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Last Access Time query filter."
                },
                "expiryTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Expiry Time query filter."
                },
                "userId":{
                    "type":"string",
                    "description":"User Id query filter."
                },
                "clientIp":{
                    "type":"string",
                    "description":"Client IP Address query filter."
                },
                "idStoreName":{
                    "type":"string",
                    "description":"Session Identifier for querying the session."
                },
                "isImpersonating":{
                    "type":"boolean",
                    "description":"Session Identifier for querying the session."
                },
                "pageSize":{
                    "type":"integer",
                    "description":"PageSize desired for the output. This parmeter is not used."
                },
                "fromIndex":{
                    "type":"integer",
                    "description":"Session from index for querying the session. This parameter is used in conjunction with the pageSize. This parameter is not used."
                },
                "userAttributes":{
                    "$ref":"#/definitions/UserAttributes"
                }
            }
        },
        "SessionData":{
            "type":"object",
            "properties":{
                "sessionId":{
                    "type":"string",
                    "description":"Session Identifier for querying the session."
                },
                "sessionIndex":{
                    "type":"string",
                    "description":"Unique session identified generated by OAM session engine."
                },
                "createTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Time at which session was created."
                },
                "updateTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Update Time for session."
                },
                "lastAccessTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Last Access Time for session."
                },
                "expiryTime":{
                    "type":"string",
                    "format":"date-time",
                    "description":"Expiry Time for the session."
                },
                "userId":{
                    "type":"string",
                    "description":"User Id with which session is associated."
                },
                "clientIp":{
                    "type":"string",
                    "description":"Client IP Address for the session."
                },
                "idStoreName":{
                    "type":"string",
                    "description":"Session Identifier where user is located for this session."
                },
                "isImpersonating":{
                    "type":"boolean",
                    "description":"Indicator if this is impersonating user session."
                },
                "userAttributes":{
                    "$ref":"#/definitions/UserAttributes"
                }
            },
            "required":[
                "userId"
            ]
        },
        "SessionResults":{
            "type":"object",
            "properties":{
                "firstLink":{
                    "type":"string",
                    "description":"Link(http(s)) to the first session page in the results."
                },
                "previousLink":{
                    "type":"string",
                    "description":"Link(http(s)) to the previous sessions page in the results."
                },
                "nextLink":{
                    "type":"string",
                    "description":"Link(http(s)) to the next sessions page in the results."
                },
                "totalRecords":{
                    "type":"integer",
                    "description":"total number records available as a result of this query. This page may be only part of those total records."
                },
                "sessions":{
                    "$ref":"#/definitions/Sessions"
                }
            }
        },
        "Error":{
            "type":"object",
            "properties":{
                "code":{
                    "type":"integer",
                    "format":"int32"
                },
                "message":{
                    "type":"string"
                },
                "fields":{
                    "type":"string"
                }
            }
        }
    },
    "tags":[
        {
            "name":"Session",
            "description":"The operations from the Session category."
        },
        {
            "name":"Sessions",
            "description":"The operations from the Sessions category."
        }
    ]
}