rest-assured/src/main/java/io/restassured/builder/RequestSpecBuilder.java
public RequestSpecBuilder setSessionId(String sessionIdName, String sessionIdValue) {
        spec.sessionId(sessionIdName, sessionIdValue);
        return this;
    }
public RequestSpecBuilder setSessionId(String sessionIdName, String sessionIdValue) {
        spec.sessionId(sessionIdName, sessionIdValue);
        return this;
    }
public RequestSpecBuilder setSessionId ( String sessionIdName , String sessionIdValue ) { spec . sessionId ( sessionIdName , sessionIdValue ) ; return this ; }
Set the session id name and value for this request. It'll override the default session id name from the configuration (by default this is {@value SessionConfig#DEFAULT_SESSION_ID_NAME}).
You can configure the default session id name by using:
<pre>
RestAssured.config = newConfig().sessionConfig(new SessionConfig().sessionIdName(&lt;sessionIdName&gt;));
</pre>
and then you can use the {@link RequestSpecBuilder#setSessionId(String)} method to set the session id value without specifying the name for each request.

@param sessionIdName  The session id name
@param sessionIdValue The session id value.
@return The request specification
Set the session id name and value for this request . It ll override the default session id name from the configuration ( by default this is { @value SessionConfig#DEFAULT_SESSION_ID_NAME } ) . You can configure the default session id name by using : <pre > RestAssured . config = newConfig () . sessionConfig ( new SessionConfig () . sessionIdName ( &lt ; sessionIdName&gt ; )) ; < / pre > and then you can use the { @link RequestSpecBuilder#setSessionId ( String ) } method to set the session id value without specifying the name for each request .