NowAPIService interface - Android
concept brazil Updated Sep 10, 2026 1 min read NowAPIServiceAndroidInterface.md
The NowAPIService interface provides the ability to perform requests on a specified ServiceNow REST API.
Note: Guest users only work for the NowAPIService interface if the REST API being accessed is configured for guest users.
| Name | Type | Description |
|---|---|---|
| configuration | NowServiceConfiguration | Service configuration to associate with the protocol. |
Parent Topic:Mobile SDK - Android
NowAPIService - data(endpoint: NowAPIService.Endpoint, queryParams: QueryParams, headers: Headers, body: String)
Calls the specified REST API on the specified ServiceNow instance.
|
Name |
Type |
Description |
|---|---|---|
|
endpoint |
NowAPIService.Endpoint |
REST endpoint to call. |
|
queryParams |
QueryParams |
Optional. Query parameter object that contains the query parameters to pass in the REST call.Default: null |
|
headers |
Headers |
Optional. Headers object that contains the headers to pass in the REST call.Default: null |
|
body |
String |
Optional. Object that contains the request body and content type to pass into the REST call.Default: null |
Java
suspend fun loadCases(): List<CaseItem> = withContext(Dispatchers.IO) { val apiService = nowServiceManager.getNowAPIService()
val result = runCatching { val response = apiService.data(NowAPIService.Endpoint( relativePath = CASES_API, requestMethod = HttpMethod.GET, requireAuth = true) ).execute()
val byteArray = response.body ?: throw Exception("Null Result") val buffer = Buffer() val reader = JsonReader.of(buffer.write(byteArray)) val listType = Types.newParameterizedType( List::class.java, CaseItem::class.java )
val resultType = Types.newParameterizedType( ResultResponse::class.java, listType ) val adapter = moshi.adapter<ResultResponse<List<CaseItem>>>(resultType) adapter.fromJson(reader) }
if (result.isSuccess) { result.getOrNull()?.result ?: throw Exception("Cases not in response") } else { throw result.exceptionOrNull() ?: Exception("Error Cases") }}131 lines · 3.6 KB
---
title: NowAPIService interface - Android
description: The NowAPIService interface provides the ability to perform requests on a specified ServiceNow REST API.Calls the specified REST API on the specified ServiceNow instance.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/api-reference/cllent-mobile-api-reference/NowAPIServiceAndroidInterface.html
release: brazil
product: Cllent Mobile API Reference
classification: cllent-mobile-api-reference
topic_type: concept
last_updated: "2026-09-10"
reading_time_minutes: 1
breadcrumb: [Mobile SDK - Android, Mobile SDK API reference, API reference, API implementation and reference]
---
# NowAPIService interface- Android
The NowAPIService interface provides the ability to perform requests on a specified ServiceNow REST API.
**Note:** Guest users only work for the NowAPIService interface if the REST API being accessed is configured for guest users.
|Name|Type|Description|
|----|----|-----------|
|configuration|[NowServiceConfiguration](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/cllent-mobile-api-reference/NowServiceConfigurationAndroidAPI.md)|Service configuration to associate with the protocol.|
**Parent Topic:**[Mobile SDK - Android](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/cllent-mobile-api-reference/MobileSDKAndroidAPI.md)
## NowAPIService - data\(endpoint: NowAPIService.Endpoint, queryParams: QueryParams, headers: Headers, body: String\)
Calls the specified REST API on the specified ServiceNow instance.
<table id="table_u3p_dkt_4pb" class="parameters"><thead><tr><th>
Name
</th><th>
Type
</th><th>
Description
</th></tr></thead><tbody><tr><td>
endpoint
</td><td>
NowAPIService.Endpoint
</td><td>
REST endpoint to call.
</td></tr><tr><td>
queryParams
</td><td>
QueryParams
</td><td>
Optional. Query parameter object that contains the query parameters to pass in the REST call.Default: null
</td></tr><tr><td>
headers
</td><td>
Headers
</td><td>
Optional. Headers object that contains the headers to pass in the REST call.Default: null
</td></tr><tr><td>
body
</td><td>
String
</td><td>
Optional. Object that contains the request body and content type to pass into the REST call.Default: null
</td></tr></tbody>
</table>|Type|Description|
|----|-----------|
|[Call](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/api-reference/cllent-mobile-api-reference/CallAndroidInterface.md)<[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/)>|Return results from the called REST endpoint.|
```
suspend fun loadCases(): List<CaseItem> = withContext(Dispatchers.IO) {
val apiService = nowServiceManager.getNowAPIService()
val result = runCatching {
val response = apiService.data(NowAPIService.Endpoint(
relativePath = CASES_API,
requestMethod = HttpMethod.GET,
requireAuth = true)
).execute()
val byteArray = response.body ?: throw Exception("Null Result")
val buffer = Buffer()
val reader = JsonReader.of(buffer.write(byteArray))
val listType = Types.newParameterizedType(
List::class.java,
CaseItem::class.java
)
val resultType = Types.newParameterizedType(
ResultResponse::class.java,
listType
)
val adapter = moshi.adapter<ResultResponse<List<CaseItem>>>(resultType)
adapter.fromJson(reader)
}
if (result.isSuccess) {
result.getOrNull()?.result ?: throw Exception("Cases not in response")
} else {
throw result.exceptionOrNull() ?: Exception("Error Cases")
}
}
```
| title | NowAPIService interface - Android |
| description | The NowAPIService interface provides the ability to perform requests on a specified ServiceNow REST API.Calls the specified REST API on the specified ServiceNow instance. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/api-reference/cllent-mobile-api-reference/NowAPIServiceAndroidInterface.html |
| release | brazil |
| product | Cllent Mobile API Reference |
| classification | cllent-mobile-api-reference |
| topic_type | concept |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Mobile SDK - AndroidMobile SDK API referenceAPI referenceAPI implementation and reference |