{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":244,"path":"api-reference/cllent-mobile-api-reference/NowDataSDKAndroidAPI.md","title":"NowDataSDK class - Android","bundle":null,"doc_type":null,"release":"australia","body":"\n# NowDataSDK class- Android\n\nThe NowDataSDK class provides functions that enable the creation and initialization of various features services such as NowGraphQLService, NowAttachmentService, NowTableService, and NowAPIService.\n\n**Parent Topic:**[Mobile SDK - Android](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/cllent-mobile-api-reference/MobileSDKAndroidAPI.md)\n\n## NowDataSDK - makeGraphQLService\\(instanceURL: URL\\)\n\nCreates and initializes an instance of the NowGraphQLService feature. This service enables access to the GraphQL API on your ServiceNow instance.\n\nFor additional information on the ServiceNow GraphQL API, see [Query record data using the GraphQL API framework](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/web-services/scripted-graph-ql.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|instanceURL|[URL](https://developer.android.com/reference/kotlin/java/net/URL.html)|URL of the ServiceNow instance to access. For example, `\"https://instance.servicenow.com\"`|\n\n|Type|Description|\n|----|-----------|\n|Result&lt;NowGraphQLService&gt;|NowGraphQLService object wrapped in a [Kotlin Result object](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/).|\n\nThe following code example shows how to call this function.\n\n```\nprivate var nowGraphQLService: NowGraphQLService? = null\n\n/**\n  * Create the NowGraphQLService once in the lifetime of the application, inside the Application class\n  * or another manager class that will be injected into other classes via dagger/hilt.\n  * NowGraphQLService should be created after initializing the NowSDK.\n  */\nsuspend fun getNowGraphQLService(): NowGraphQLService? {\n  if (nowGraphQLService != null) return nowGraphQLService\n\n  return NowDataSDK.makeGraphQLService(URL(\"https://instance-name.service-now.com\")).getOrThrow()\n    .also { this.nowGraphQLService = it }\n}\n```\n\n## NowDataSDK - makeNowAPIService\\(instanceURL: URL\\)\n\nCreates and initializes an instance of the NowAPIService service. This service allows you to access the public REST APIs exposed by your ServiceNow instance.\n\nIn addition, you can develop custom scripted REST APIs within your ServiceNow instance and access them within your Android application using the [NowAPIService](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/cllent-mobile-api-reference/NowAPIServiceAndroidInterface.md) API. For additional information on ServiceNow REST APIs, see [Scripted REST APIs](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-api-explorer/c_CustomWebServices.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|instanceURL|[URL](https://developer.android.com/reference/kotlin/java/net/URL.html)|URL of the ServiceNow instance to access. For example, `\"https://instance.servicenow.com\"`|\n\n|Type|Description|\n|----|-----------|\n|Result&lt;NowAPIService&gt;|NowAPIService wrapped in a [Kotlin Result object](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/).|\n\nThe following code example shows how to call this function.\n\n```\nprivate var nowApiService: NowAPIService? = null\n\n/**\n  * Create the NowAPIService once in the lifetime of the application inside the Application class\n  * or another manager class that will be injected into other classes via dagger/hilt.\n  * NowAPIService should be created after initializing the NowSDK\n  */\nsuspend fun getNowApiService(): NowAPIService? {\n  if (nowApiService != null) return nowApiService\n\n  return NowDataSDK.makeAPIService(URL(\"https://instance-name.service-now.com\")).getOrThrow()\n    .also { this.nowApiService = it }\n}\n```\n\n## NowDataSDK - makeNowAttachmentService\\(instanceURL: URL\\)\n\nCreates and initializes an instance of the NowAttachmentService feature.\n\nThis service enables you to upload, download, and delete attachment files from your ServiceNow instance. After you upload an attachment to your instance, it generates metadata for the attachment that you can then download into your Android application.\n\nFor additional information on ServiceNow attachments, see [Attachment API](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/c_AttachmentAPI.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|instanceURL|[URL](https://developer.android.com/reference/kotlin/java/net/URL.html)|URL of the ServiceNow instance to access. For example, `\"https://instance.servicenow.com\"`|\n\n|Type|Description|\n|----|-----------|\n|Result&lt;NowAttachmentService&gt;|NowAttachmentService object wrapped in a [Kotlin Result object](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/).|\n\nThe following code example shows how to call this method.\n\n```\nprivate var nowAttachmentService: NowAttachmentService? = null\n\n/**\n  * Create the NowAttachmentService once in the lifetime of the application inside the Application\n  * class or another manager class that will be injected into other classes via dagger/hilt.\n  * NowAttachmentService should be created after initializing the NowSDK.\n  */\nsuspend fun getNowAttachmentService(): NowAttachmentService? {\n  if (nowAttachmentService != null) return nowAttachmentService\n\n  return NowDataSDK.makeAttachmentService(URL(\"https://instance-name.service-now.com\"))\n    .getOrThrow()\n    .also { this.nowAttachmentService = it }\n}\n```\n\n## NowDataSDK - makeTableService\\(instanceURL: URL\\)\n\nCreates and initializes an instance of the NowTableService feature.\n\nThis service enables you to access to the REST Table API on a ServiceNow instance. For additional information on the REST Table API, see [Table API](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/rest-apis/c_TableAPI.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|instanceURL|[URL](https://developer.android.com/reference/kotlin/java/net/URL.html)|URL of the ServiceNow instance to access. For example, `\"https://instance.servicenow.com\"`|\n\n|Type|Description|\n|----|-----------|\n|Result&lt;NowTableService&gt;|NowTableService object wrapped in a [Kotlin Result object](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/).|\n\nThe following code example shows how to call this function.\n\n```\nprivate var nowTableService: NowTableService? = null\n\n/**\n  * Create the NowTableService once in the lifetime of the application inside the Application\n  * class or another manager class that will be injected into other classes via dagger/hilt.\n  * NowTableService should be created after initializing the NowSDK.\n  */\nsuspend fun getNowTableService(): NowTableService? {\n  if (nowTableService != null) return nowTableService\n\n  return NowDataSDK.makeTableService(URL(\"https://instance-name.service-now.com\")).getOrThrow()\n    .also { this.nowTableService = it }\n}\n```\n\n"}}