Package com.microstrategy.webapi.restApi
Class IServerRestClientBuilder
- java.lang.Object
-
- com.microstrategy.webapi.restApi.RestClientBuilder
-
- com.microstrategy.webapi.restApi.IServerRestClientBuilder
-
- Direct Known Subclasses:
IServerRestClientCluster
public class IServerRestClientBuilder extends RestClientBuilder
Builder pattern to build I-Server REST ClientEx. Sample Code
GET API call
RestClient restClient = new IServerRestClientBuilder() .sessionId(iServerSession.getSessionID()) .relativeUrl("/messages/B19DEDCC11D4E0EFC000EB9495D0F44F/bookmarks") .methodTypes(MethodTypes.GET) .build();
POST API callRestClient restClient = new IServerRestClientBuilder() .sessionId(iServerSession.getSessionID()) .relativeUrl("/messages/B19DEDCC11D4E0EFC000EB9495D0F44F/bookmarks") .mediaType(MediaTypes.APPLICATION_JSON) .body("{}") .methodTypes(MethodTypes.POST) .build();
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
I_SERVER_PROJECT_ID_HEADER
protected static java.lang.String
I_SERVER_SESSION_HEADER
protected java.lang.String
relativeUrl
protected IDSSXMLClusterNode
server
protected java.lang.String
sessionId
-
Fields inherited from class com.microstrategy.webapi.restApi.RestClientBuilder
body, connectTimeout, headers, isTLSEnabled, mediaType, methodTypes, readTimeout, responseWrapper, url
-
-
Constructor Summary
Constructors Constructor Description IServerRestClientBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IServerRestClientBuilder
addheader(java.lang.String key, java.lang.String value)
adds individual header key-valueIServerRestClientBuilder
body(java.lang.String body)
String as request body.RestClient
build()
IServerRestClientBuilder
connectTimeout(int connectTimeout)
Set http connect timeoutIServerRestClientBuilder
headers(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
IServerRestClientBuilder
mediaType(MediaTypes mediaType)
Set media type using EnumIServerRestClientBuilder
mediaType(java.lang.String mediaType)
Set media type using String valueIServerRestClientBuilder
methodTypes(MethodTypes methodTypes)
IServerRestClientBuilder
readTimeout(int readTimeout)
Set http read timeoutIServerRestClientBuilder
relativeUrl(java.lang.String relativeUrl)
Provide a relative URLIServerRestClientBuilder
server(IDSSXMLClusterNode server)
IServerRestClientBuilder
sessionId(java.lang.String sessionId)
Set the session IDIServerRestClientBuilder
streamBody(java.io.InputStream inputStream)
Input stream as request body.java.lang.String
toString()
IServerRestClientBuilder
url(java.lang.String url)
-
Methods inherited from class com.microstrategy.webapi.restApi.RestClientBuilder
responseWrapper
-
-
-
-
Field Detail
-
I_SERVER_SESSION_HEADER
protected static final java.lang.String I_SERVER_SESSION_HEADER
- See Also:
- Constant Field Values
-
I_SERVER_PROJECT_ID_HEADER
protected static final java.lang.String I_SERVER_PROJECT_ID_HEADER
- See Also:
- Constant Field Values
-
sessionId
protected java.lang.String sessionId
-
relativeUrl
protected java.lang.String relativeUrl
-
server
protected IDSSXMLClusterNode server
-
-
Method Detail
-
sessionId
public IServerRestClientBuilder sessionId(java.lang.String sessionId)
Set the session ID- Parameters:
sessionId
-
-
relativeUrl
public IServerRestClientBuilder relativeUrl(java.lang.String relativeUrl)
Provide a relative URL- Parameters:
relativeUrl
-
-
server
public IServerRestClientBuilder server(IDSSXMLClusterNode server)
-
url
public IServerRestClientBuilder url(java.lang.String url)
- Overrides:
url
in classRestClientBuilder
- Returns:
-
body
public IServerRestClientBuilder body(java.lang.String body)
Description copied from class:RestClientBuilder
String as request body.- Overrides:
body
in classRestClientBuilder
- Parameters:
body
- string- Returns:
- builder
-
streamBody
public IServerRestClientBuilder streamBody(java.io.InputStream inputStream)
Description copied from class:RestClientBuilder
Input stream as request body.- Overrides:
streamBody
in classRestClientBuilder
- Parameters:
inputStream
- input stream- Returns:
- builder
-
methodTypes
public IServerRestClientBuilder methodTypes(MethodTypes methodTypes)
- Overrides:
methodTypes
in classRestClientBuilder
- Returns:
-
headers
public IServerRestClientBuilder headers(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
- Overrides:
headers
in classRestClientBuilder
- Returns:
-
addheader
public IServerRestClientBuilder addheader(java.lang.String key, java.lang.String value)
Description copied from class:RestClientBuilder
adds individual header key-value- Overrides:
addheader
in classRestClientBuilder
- Returns:
-
mediaType
public IServerRestClientBuilder mediaType(java.lang.String mediaType)
Description copied from class:RestClientBuilder
Set media type using String value- Overrides:
mediaType
in classRestClientBuilder
- Parameters:
mediaType
- Any valid "accept" header value- Returns:
-
mediaType
public IServerRestClientBuilder mediaType(MediaTypes mediaType)
Description copied from class:RestClientBuilder
Set media type using Enum- Overrides:
mediaType
in classRestClientBuilder
- Returns:
-
connectTimeout
public IServerRestClientBuilder connectTimeout(int connectTimeout)
Set http connect timeout- Overrides:
connectTimeout
in classRestClientBuilder
- Parameters:
connectTimeout
-- Returns:
-
readTimeout
public IServerRestClientBuilder readTimeout(int readTimeout)
Set http read timeout- Overrides:
readTimeout
in classRestClientBuilder
- Parameters:
readTimeout
-- Returns:
-
build
public RestClient build() throws MSTRWebAPIException
- Overrides:
build
in classRestClientBuilder
- Returns:
- Throws:
MSTRWebAPIException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classRestClientBuilder
-
-