Class Unirest
java.lang.Object
kong.unirest.core.Unirest
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Configconfig()Access the default configuration for the primary Unirest instance.static HttpRequestWithBodyStart a DELETE HttpRequest which supports a body from the primary configstatic GetRequestStart a GET HttpRequest which does not support a body from the primary configstatic GetRequestStart a HEAD HttpRequest which does not support a body from the primary configstatic JsonPatchRequestStart a PATCH HttpRequest which supports a JSON Patch builder.static GetRequestStart a OPTIONS HttpRequest which does not support a body from the primary configstatic HttpRequestWithBodyStart a PATCH HttpRequest which supports a body from the primary configstatic HttpRequestWithBodyStart a POST HttpRequest which supports a body from the primary configstatic UnirestInstancereturn the primary UnirestInstance.static HttpRequestWithBodyStart a PUT HttpRequest which supports a body from the primary configstatic HttpRequestWithBodystatic voidshutDown()Close the asynchronous client and its event loop.static voidshutDown(boolean clearOptions) Close the asynchronous client and its event loop.static UnirestInstanceSpawn a new Unirest Instance with a new config.static WebSocketRequest
-
Field Details
-
-
Constructor Details
-
Unirest
public Unirest()
-
-
Method Details
-
config
Access the default configuration for the primary Unirest instance.- Returns:
- the config object of the primary instance
-
shutDown
public static void shutDown()Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit. This will also clear any options returning Unirest to a default state -
shutDown
public static void shutDown(boolean clearOptions) Close the asynchronous client and its event loop. Use this method to close all the threads and allow an application to exit.- Parameters:
clearOptions- indicates if options should be cleared. Note that the HttpClient, AsyncClient and thread monitors will not be retained after shutDown.
-
get
Start a GET HttpRequest which does not support a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
head
Start a HEAD HttpRequest which does not support a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
options
Start a OPTIONS HttpRequest which does not support a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
post
Start a POST HttpRequest which supports a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
delete
Start a DELETE HttpRequest which supports a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
patch
Start a PATCH HttpRequest which supports a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
put
Start a PUT HttpRequest which supports a body from the primary config- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
jsonPatch
Start a PATCH HttpRequest which supports a JSON Patch builder. this supports RFC-6902 https://tools.ietf.org/html/rfc6902- Parameters:
url- the endpoint to access. Can include placeholders for path params using curly braces {}- Returns:
- A HttpRequest builder
-
request
-
webSocket
-
spawnInstance
Spawn a new Unirest Instance with a new config. Don't forget to shut it down when your done. It will not be tracked and shutdown with Unirest.shutDown()- Returns:
- a new UnirestInstance
-
primaryInstance
return the primary UnirestInstance.- Returns:
- a new UnirestInstance
-