---
sourceDocument: Referência de API do Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência de API do Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe NowDataSDK - Android

# Classe NowDataSDK - Android {#ariaid-title1}

* Versão de lançamento: Xanadu
* 
* Atualizado 1 de ago. de 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 min. de leitura

A classe NowDataSDK fornece funções que permitem a criação e a inicialização de vários serviços de recursos, como NowGraphQLService, NowAttachmentService, NowTableService e NowAPIService.

## NowDataSDK - makeGraphQLService(instanceURL: URL) {#ariaid-title2}

Cria e inicializa uma instância do recurso NowGraphQLService. Este serviço permite o acesso à GraphQL API em sua instância ServiceNow.
Para obter informações adicionais sobre a ServiceNow GraphQL API, consulte [Consultar dados de registro usando a estrutura da GraphQL API](https://servicenow-prod.fluidtopics.net/ds_bJbMvZB3mObasDY~Fdg "Crie uma GraphQL API personalizada para consultar dados de registro de um componente ou de um sistema de terceiros.").
{#NDataSDK-makeGraphQLService_S_O_O__table_nvx_zbt_4pb__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL da instância ServiceNow a ser acessada. Por exemplo, `"https://instance.servicenow.com"` |
[Tabela 1. Parâmetros]

{#NDataSDK-makeGraphQLService_S_O_O__table_nvx_zbt_4pb} {#NDataSDK-makeGraphQLService_S_O_O__table_ovx_zbt_4pb__entry__2}

| Tipo | Descrição |
|-|-|
| Resultado\<NowGraphQLService\> | Objeto NowGraphQLService encapsulado em um [objeto Resultado do Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 2. Retorna]

{#NDataSDK-makeGraphQLService_S_O_O__table_ovx_zbt_4pb}  
O exemplo de código a seguir mostra como chamar esta função.

    private var nowGraphQLService: NowGraphQLService? = null

    /**
      * Create the NowGraphQLService once in the lifetime of the application, inside the Application class
      * or another manager class that will be injected into other classes via dagger/hilt.
      * NowGraphQLService should be created after initializing the NowSDK.
      */
    suspend fun getNowGraphQLService(): NowGraphQLService? {
      if (nowGraphQLService != null) return nowGraphQLService

      return NowDataSDK.makeGraphQLService(URL("https://instance-name.service-now.com")).getOrThrow()
        .also { this.nowGraphQLService = it }
    }

## NowDataSDK - makeNowAPIService(instanceURL: URL) {#ariaid-title3}

Cria e inicializa uma instância do serviço NowAPIService. Este serviço permite que você acesse as REST APIs públicas expostas por sua instância ServiceNow.
Além disso, você pode desenvolver REST APIs com script personalizado em sua instância ServiceNow e acessá-las em sua aplicação Android usando a API [NowAPIService](https://servicenow-prod.fluidtopics.net/L6HruwUIp6YUokLCsvDreA#NowAPIServiceAndroidInterface "A interface NowAPIService oferece a capacidade de executar solicitações em uma ServiceNow REST API especificada."). Para obter informações adicionais sobre ServiceNow REST APIs, consulte [Scripted REST APIs](https://servicenow-prod.fluidtopics.net/NkO~PM_OGwHpTRvBtL6ADg "O recurso de API REST de script permite que os desenvolvedores de aplicações criem APIs de serviço web personalizadas.").
{#NDataSDK-makeNowAPIService_S_O_O__table_rjf_lft_4pb__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL da instância ServiceNow a ser acessada. Por exemplo, `"https://instance.servicenow.com"` |
[Tabela 3. Parâmetros]

{#NDataSDK-makeNowAPIService_S_O_O__table_rjf_lft_4pb} {#NDataSDK-makeNowAPIService_S_O_O__table_sjf_lft_4pb__entry__2}

| Tipo | Descrição |
|-|-|
| Resultado\<NowAPIService\> | NowAPIService encapsulado em um [objeto de resultado do Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 4. Retorna]

{#NDataSDK-makeNowAPIService_S_O_O__table_sjf_lft_4pb}  
O exemplo de código a seguir mostra como chamar essa função.

    private var nowApiService: NowAPIService? = null

    /**
      * Create the NowAPIService once in the lifetime of the application inside the Application class
      * or another manager class that will be injected into other classes via dagger/hilt.
      * NowAPIService should be created after initializing the NowSDK
      */
    suspend fun getNowApiService(): NowAPIService? {
      if (nowApiService != null) return nowApiService

      return NowDataSDK.makeAPIService(URL("https://instance-name.service-now.com")).getOrThrow()
        .also { this.nowApiService = it }
    }

## NowDataSDK - makeNowAttachmentService(instanceURL: URL) {#ariaid-title4}

Cria e inicializa uma instância do recurso NowAttachmentService.
Este serviço permite que você carregue, baixe e exclua arquivos de anexo da sua instância ServiceNow. Depois de carregar um anexo para sua instância, ele gera metadados para o anexo que você pode baixar para sua aplicação Android.

Para obter informações adicionais sobre ServiceNow anexos, consulte [API de anexos](https://servicenow-prod.fluidtopics.net/ucSwEIgNhdaEXR1UlTX~9A#c_AttachmentAPI "A API de anexos fornece endpoints que permitem carregar e consultar anexos de arquivo.").
{#NDataSDK-makeNowAttachService_S_O_O__table_bnd_qgt_4pb__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL da instância ServiceNow a ser acessada. Por exemplo, `"https://instance.servicenow.com"` |
[Tabela 5. Parâmetros]

{#NDataSDK-makeNowAttachService_S_O_O__table_bnd_qgt_4pb} {#NDataSDK-makeNowAttachService_S_O_O__table_cnd_qgt_4pb__entry__2}

| Tipo | Descrição |
|-|-|
| Resultado\<NowAttachmentService\> | Objeto NowAttachmentService encapsulado em um [objeto Resultado do Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 6. Retorna]

{#NDataSDK-makeNowAttachService_S_O_O__table_cnd_qgt_4pb}  
O exemplo de código a seguir mostra como chamar este método.

    private var nowAttachmentService: NowAttachmentService? = null

    /**
      * Create the NowAttachmentService once in the lifetime of the application inside the Application
      * class or another manager class that will be injected into other classes via dagger/hilt.
      * NowAttachmentService should be created after initializing the NowSDK.
      */
    suspend fun getNowAttachmentService(): NowAttachmentService? {
      if (nowAttachmentService != null) return nowAttachmentService

      return NowDataSDK.makeAttachmentService(URL("https://instance-name.service-now.com"))
        .getOrThrow()
        .also { this.nowAttachmentService = it }
    }

## NowDataSDK - makeTableService(instanceURL: URL) {#ariaid-title5}

Cria e inicializa uma instância do recurso NowTableService.
Este serviço permite que você acesse a REST Table API em uma instância ServiceNow. Para obter informações adicionais sobre a REST Table API, consulte [Table API](https://servicenow-prod.fluidtopics.net/4xLP4HFNgOVYWze_ozFdZw#c_TableAPI "A API da tabela fornece endpoints que permitem executar operações de criação, leitura, atualização e exclusão (CRUD) em tabelas existentes.").
{#NDataSDK-makeTableService_S_O_O__table_jxh_vht_4pb__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL da instância ServiceNow a ser acessada. Por exemplo, `"https://instance.servicenow.com"` |
[Tabela 7. Parâmetros]

{#NDataSDK-makeTableService_S_O_O__table_jxh_vht_4pb} {#NDataSDK-makeTableService_S_O_O__table_kxh_vht_4pb__entry__2}

| Tipo | Descrição |
|-|-|
| Resultado\<NowTableService\> | Objeto NowTableService encapsulado em um [objeto Resultado do Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 8. Retorna]

{#NDataSDK-makeTableService_S_O_O__table_kxh_vht_4pb}  
O exemplo de código a seguir mostra como chamar esta função.

    private var nowTableService: NowTableService? = null

    /**
      * Create the NowTableService once in the lifetime of the application inside the Application
      * class or another manager class that will be injected into other classes via dagger/hilt.
      * NowTableService should be created after initializing the NowSDK.
      */
    suspend fun getNowTableService(): NowTableService? {
      if (nowTableService != null) return nowTableService

      return NowDataSDK.makeTableService(URL("https://instance-name.service-now.com")).getOrThrow()
        .also { this.nowTableService = it }
    }


