public interface RequestBuilder
Resource
based request to any Okta endpoint. Not all Okta endpoints are
implemented by this SDK currently, this interface allow to make requests with:
body
// create a resource
Resource userPasswordRequest = client.instantiate(ExtensibleResource)
userPasswordRequest.put("credentials", client.instantiate(ExtensibleResource)
.put("password", client.instantiate(ExtensibleResource)
.put("value", "aPassword1!".toCharArray())))
// make a POST request to `/api/v1/users/{userId}` and return a User resource
User result = client.getDataStore().http()
.setBody(userPasswordRequest)
.post("/api/v1/users/"+ userId, User.class)
Modifier and Type | Method and Description |
---|---|
RequestBuilder |
addHeaderParameter(String key,
List<String> values)
Adds a header parameter to the request builder.
|
RequestBuilder |
addHeaderParameter(String key,
String value)
Adds a header parameter to the request builder.
|
RequestBuilder |
addQueryParameter(String key,
String value)
Adds a query parameter to the request builder.
|
void |
delete(String href)
Executes a
DELETE request. |
<T extends Resource> |
get(String href,
Class<T> type)
Executes a
GET request and returns a Resource. |
InputStream |
getRaw(String href)
Executes a
GET request and returns a raw response. |
default void |
post(String href)
Executes a
POST request. |
<T extends Resource> |
post(String href,
Class<T> type)
Executes a
POST request and returns a Resource. |
void |
put(String href)
Executes a
PUT request and updates the resource used as the body . |
RequestBuilder |
setBody(Resource resource)
Sets the Resource body for the request.
|
RequestBuilder |
setHeaderParameters(Map<String,List<String>> headerParams)
Sets the header parameters to be used for the request.
|
RequestBuilder |
setQueryParameters(Map<String,String> queryParams)
Sets the query parameters to be used for the request.
|
RequestBuilder setBody(Resource resource)
resource
- the request bodyRequestBuilder addQueryParameter(String key, String value)
key
- the query parameter field namevalue
- the query parameter field valueRequestBuilder setQueryParameters(Map<String,String> queryParams)
queryParams
- the query parameters to be used for the requestRequestBuilder addHeaderParameter(String key, String value)
key
- the header parameter field namevalue
- the header parameter field valueRequestBuilder addHeaderParameter(String key, List<String> values)
key
- the header parameter field namevalues
- the header parameter field valuesRequestBuilder setHeaderParameters(Map<String,List<String>> headerParams)
headerParams
- the header parameters to be used for the request<T extends Resource> T get(String href, Class<T> type)
GET
request and returns a Resource.T
- the Resource type to returnhref
- an absolute or partial HREFtype
- the Resource type to returnInputStream getRaw(String href)
GET
request and returns a raw response.href
- an absolute or partial HREFvoid put(String href)
PUT
request and updates the resource used as the body
.href
- an absolute or partial HREF<T extends Resource> T post(String href, Class<T> type)
POST
request and returns a Resource.T
- the Resource type to returnhref
- an absolute or partial HREFtype
- the Resource type to returndefault void post(String href)
POST
request.href
- an absolute or partial HREFvoid delete(String href)
DELETE
request.href
- an absolute or partial HREFCopyright © 2017–2023 Okta. All rights reserved.