Errors
ApiError
Class responsible for managing errors.
Declared In:com.synerise.sdk.error.ApiError
Declaration:
public class ApiError
class ApiError
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| errorBody | ApiErrorBody | yes | - | API Error Body |
| httpErrorCategory | HttpErrorCategory | no | - | HTTP error category |
| errorType | ErrorType | no | - | Error type |
| reason | ApiErrorReason | no | - | Detailed reason of the error. Available in Android SDK 6.17.0 and later |
| message | String | no | - | Human-readable description of the error, suitable for logging. Available in Android SDK 6.17.0 and later |
| httpCode | int | no | - | HTTP error code |
| throwable | Throwable | yes | - | Android throwable |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
Prints stack trace on original Throwable instance.
public void printStackTrace()
Returns true if the request failed for a temporary reason and the SDK will send it again in the background when the device is connected. Returns false if the request failed and won't be retried. Available in Android SDK 6.17.0 and later.
public boolean isBackgroundRetryScheduled()
ApiErrorBody
Class responsible for providing the API error body.
Declared In:com.synerise.sdk.error.ApiErrorBody
Declaration:
public class ApiErrorBody implements Serializable
class ApiErrorBody:Serializable
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| error | String | no | - | String representation of the returned HTTP status code |
| message | String | no | - | Error message |
| path | String | no | - | Endpoint path in which the error has occurred |
| status | int | no | - | Error's HTTP status code |
| errorCauses | List<ApiErrorCause> | yes | - | Optional list of error causes, mostly occurs when 400 HTTP code is returned |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
There are only getters.
ApiErrorCause
Class responsible for providing the API error cause.
Declared In:com.synerise.sdk.error.ApiErrorCause
Declaration:
public class ApiErrorCause implements Serializable
class ApiErrorCause:Serializable
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| field | String | yes | - | Main error cause, for example, the name of the field that failed validation |
| message | String | yes | - | Error message |
| code | int | no | - | Unique error cause code |
| rejectedValue | String | yes | - | Optional rejected value |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
There are only getters.
ApiErrorReason
This enum contains values which describe the detailed reason of an ApiError. Each reason belongs to exactly one ErrorType.
This enum is available in Android SDK 6.17.0 and later.
IMPORTANT: New values may be added in future SDK versions. When you use switch or when with this enum, always handle the default or else branch.
Declared In:com.synerise.sdk.error.ApiErrorReason
Declaration:
public enum ApiErrorReason
public enum ApiErrorReason
Values:
| Property | Error type | Description |
|---|---|---|
| HTTP | HTTP_ERROR |
The server responded with an HTTP error status. Details are available in getErrorBody() and getHttpCode() |
| HOST_UNRESOLVED | NETWORK_ERROR |
The DNS lookup failed. This usually means there is no Internet connection |
| TIMEOUT | NETWORK_ERROR |
The connection, read, or write timed out |
| CONNECTION_REFUSED | NETWORK_ERROR |
The TCP connection was refused or the host was unreachable, for example when a DNS blocker resolved the host to 127.0.0.1 |
| TLS_HANDSHAKE_FAILED | NETWORK_ERROR |
The TLS handshake failed, for example because the certificate path couldn't be validated |
| PEER_NOT_VERIFIED | NETWORK_ERROR |
The server certificate was rejected after the TLS handshake because it doesn't match the public keys pinned in the SDK or the hostname doesn't match (for example, a captive portal serving its own certificate) |
| NETWORK_IO | NETWORK_ERROR |
Any other I/O error while executing the request |
| RESPONSE_PARSING_FAILED | UNKNOWN |
The server responded, but the response body couldn't be parsed or was empty (for example, a captive portal or firewall page was returned instead of JSON) |
| NO_TOKEN | NO_TOKEN |
The request requires a client token and no token is available |
| UNEXPECTED | UNKNOWN |
Any other error, for example an application-level error or a missing response when one was expected |
Methods:
Returns a short, human-readable description of the reason, for example Connection timed out
public String getDescription()
Returns the ErrorType that the reason belongs to.
public ErrorType getErrorType()
ErrorType
This enum contains values for error types.
Declared In:com.synerise.sdk.error.ErrorType
Declaration:
public enum ErrorType
public enum ErrorType
Values:
| Property | Description |
|---|---|
| HTTP_ERROR | HTTP error |
| NETWORK_ERROR | Network error |
| NO_TOKEN | No token |
| UNKNOWN | Unknown error type |
Methods:
There are no methods.
HttpErrorCategory
This enum contains values for HTTP error categories.
Declared In:com.synerise.sdk.error.HttpErrorCategory
Declaration:
public enum HttpErrorCategory
public enum HttpErrorCategory
Values:
| Property | Value | Description |
|---|---|---|
| BAD_REQUEST | 400 | Bad request |
| UNAUTHORIZED | 401 | Unauthorized (no token, wrong token) |
| FORBIDDEN | 403 | Forbidden (insufficient permissions) |
| NOT_FOUND | 404 | Resource not found |
| RANGE_NOT_SATISFIABLE | 416 | Range not satisfiable |
| SERVER_ERROR | 500-599 | Server error |
| UNKNOWN | -1 | Unknown error |
Methods:
This method retrieves the HTTP error category.
public static HttpErrorCategory getHttpErrorCategory(int code)
Misc
ApiQuerySortingOrder
This enum contains values for query sorting order.
Declared In:com.synerise.sdk.core.types.enums.ApiQuerySortingOrder
Declaration:
public enum ApiQuerySortingOrder
public enum ApiQuerySortingOrder
Values:
| Property | Value | Description |
|---|---|---|
| ASCENDING | "asc" | Sorting order |
| DESCENDING | "desc" | Sorting order |
Methods:
This method retrieves the order.
public String getOrder()
This method retrieves the order.
public static ApiQuerySortingOrder getBySortingOrder(String order)
ScreenViewApiQuery
Class responsible for creating a query to the Screen View API.
Declared In:com.synerise.sdk.content.model.ScreenViewApiQuery
Declaration:
public class ScreenViewApiQuery
class ScreenViewApiQuery
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| feedSlug | String | no | nil | Identifies a specific screen view feed |
| productID | String | yes | nil | Item identifier |
| params | HashMap<String,Object> | yes | nil | Additional parameters to pass for Inserts in the screen view. For example, if the insert is {{ foo }}, you need to pass the value of foo |
Initializers:
There is a constructor.
public ScreenViewApiQuery(String feedSlug, String productId)
Methods:
Setter for feedSlug
public void setFeedSlug(String feedSlug)
Setter for productId
public void setProductId(String productId)
ScreenView
Declared In:com.synerise.sdk.content.model.screenview
Declaration:
public class ScreenView
class ScreenView
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| id | String | no | Screen View's ID |
| name | String | no | Screen View's name |
| hash | String | no | Screen View's hash |
| path | String | no | URL of the screen view's definition |
| priority | Integer | no | Screen View's priority (1-99, where 1 is the highest) |
| audience | Audience | no | - |
| data | Object | no | Content of the screen view |
| createdAt | Date | no | Screen View's creation date |
| updatedAt | Date | no | Screen View's update date |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
There are only getters for the above properties.
ScreenView.Audience
Declared In:com.synerise.sdk.content.model.screenview
Declaration:
public class Audience
class Audience
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| segments | List | yes | Audience's segments |
| query | String | yes | Audience's query |
| targetType | String | yes | Audience's target type |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
There are only getters for the above properties.
BrickworksApiQuery
Class responsible for creating a query to the Brickworks API.
Declared In:com.synerise.sdk.content.model.BrickworksApiQuery
Declaration:
public class BrickworksApiQuery
class BrickworksApiQuery
Properties:
| Property | Type | Optional | Description |
|---|---|---|---|
| schemaSlug | String | no | Unique identifier (appName/API name) of a schema |
| recordSlug | String | yes1 | Unique identifier (slug/slug) of a record |
| recordId | String | yes1 | Unique identifier (id/UUID) of a record |
| context | Object | yes | Key/value properties for {{ context.keyName }} inserts in the record |
| fieldContext | Object | yes | Additional properties for recommendation and many-to-one field types |
1 You must provide one of the identifiers.
Initializers:
There is a constructor:
public BrickworksApiQuery()
Methods:
Setter for record slug:
public void setRecordSlug(String recordSlug)
Setter for record ID:
public void setRecordId(String recordId)
Setter for schema slug (appId):
public void setSchemaSlug(String schemaSlug)
Setter for context:
public void setContext(HashMap<String, Object> context)
Setter for field context:
public void setFieldContext(HashMap<String, Object> fieldContext)
Removed symbols
ScreenViewResponse
Class responsible for receiving screen views.
Declared In:com.synerise.sdk.content.model.ScreenViewResponse
Declaration:
public class ScreenViewResponse
class ScreenViewResponse
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| audience | Audience | no | - | Audience of a Screen view |
| createdAt | String | no | - | Creation time of a screen view |
| data | Object | no | - | Content of a screen view |
| id | String | no | - | Screen view ID |
| hash | String | no | - | Screen view hash |
| name | String | no | - | Screen view name |
| parentVersion | String | no | - | Screen view parent version |
| path | String | no | - | Screen view path |
| priority | Integer | no | - | Screen view priority |
| updatedAt | String | no | - | Screen view update time |
| version | String | no | - | Screen view version |
NOTE: All the properties above are accessible by using getters.
Initializers:
There are no initializers.
Methods:
Getters and setters for the above properties.
ScreenViewResponse.Audience
Audience model for screen view campaigns.
Declared In:com.synerise.sdk.content.model.Audience
Declaration:
public class Audience
class Audience
Properties:
| Property | Type | Optional | Default | Description |
|---|---|---|---|---|
| ids | List | no | - | List of segmentation IDs |
| query | String | no | - | Query for the analytics engine |
NOTE: All the properties above are accessible by using getters.
Methods:
There are getters and setters for the above properties.