Package com.sparkpost.transport
Interface IRestConnection
- All Known Implementing Classes:
RestConnection
public interface IRestConnection
-
Field Summary
Fields Modifier and Type Field Description static StringdefaultApiEndpointDefault endpoint to use for connections : https://api.sparkpost.com/api/v1static StringSPC_EU_ENDPOINTstatic StringSPC_US_ENDPOINTstatic StringSUBACCOUNT_HEADER -
Method Summary
Modifier and Type Method Description voidaddHeader(String key, String value)Responsedelete(Endpoint endpoint)Perform an HTTP DELETE request.Responseget(Endpoint endpoint)Perform an HTTP GET request.Responsepost(Endpoint endpoint, String json)Perform an HTTP POST request.Responseput(Endpoint endpoint, String json)Perform an HTTP PUT request.
-
Field Details
-
SPC_EU_ENDPOINT
- See Also:
- Constant Field Values
-
SPC_US_ENDPOINT
- See Also:
- Constant Field Values
-
SUBACCOUNT_HEADER
- See Also:
- Constant Field Values
-
defaultApiEndpoint
Default endpoint to use for connections : https://api.sparkpost.com/api/v1- See Also:
- Constant Field Values
-
-
Method Details
-
addHeader
- Parameters:
key- The HTTP header keyvalue- The HTTP header value
-
get
Perform an HTTP GET request. This method throws an exception if the server returns anything else than a 200.- Parameters:
endpoint- API endpoint to send the request to.- Returns:
- Server response to the request.
- Throws:
SparkPostException- if something goes wrong
-
post
Perform an HTTP POST request. This method throws an exception if the server returns anything else than a 200.- Parameters:
endpoint- API endpoint to send the request to.json- POST data block to send with the request. May be null.- Returns:
- Server response to the request
- Throws:
SparkPostException- if something goes wrong
-
put
Perform an HTTP PUT request. This method throws an exception if the server returns anything else than a 200.- Parameters:
endpoint- API endpoint to send the request to.json- PUT data block to send with the request. May be null.- Returns:
- Server response to the request.
- Throws:
SparkPostException- if something goes wrong
-
delete
Perform an HTTP DELETE request. This method throws an exception if the server returns anything else than a 200.- Parameters:
endpoint- API endpoint to send the request to.- Returns:
- Server response to the request.
- Throws:
SparkPostException- if something goes wrong
-