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

 Release :

    - brazil

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência de API do Brasil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Interaja com dados da tabela em uma ServiceNow instância

# Interaja com dados da tabela em uma ServiceNow instância {#ariaid-title1}

Versão de lançamento: Brazil  
Atualizado 10 de set. de 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 min. de leitura  
O Mobile SDK permite que você interaja com dados em tabelas que residem em sua ServiceNow instância. Você pode interagir com esses dados por meio da ServiceNow API Tabela REST usando a API NowTableService() que chama diretamente a interface REST ou por meio da API NowGraphQLService() que executa uma consulta GraphQL especificada na API GraphQL REST.
Se você quiser retornar dados de várias tabelas em uma única chamada, precisará usar a API NowGraphQLService(). Se você precisar interagir com ServiceNow APIs REST que não sejam a API de tabela, consulte [Interaja com a REST API pública em uma ServiceNow instância](https://servicenow-prod.fluidtopics.net/AB9c25AujNRNal1~HymdfQ "O Mobile SDK fornece a funcionalidade que permite Android que as aplicações chamem a REST API pública em uma ServiceNow instância.").

## Usando o NowGraphQLService para interagir com ServiceNow tabelas {#mobsdk-and-interact_data_instance__section_kxm_wdf_hqb}

A [Interface do NowGraphQLService - Android](https://servicenow-prod.fluidtopics.net/q_9A40X_YDbOFRN~DQqa6w#NowGQLServiceAndroidInterface "A interface do NowGraphQLService fornece funções que permitem que você faça solicitações GraphQL para seu ServiceNow por meio da API GraphQL.") classe NowGraphQLService fornece métodos que permitem construir e executar consultas GraphQL em uma tabela especificada em sua ServiceNow instância se o usuário conectado tiver a autorização adequada. Você pode definir todas as operações de CRUD na consulta GraphQL.  
O exemplo a seguir mostra como importar a estrutura NowData e inicializar um objeto NowGraphQLService que você pode usar para interagir com tabelas em sua ServiceNow instância.

    /**
     * Helper class used to handle different Now service instances.
     */
    @Singleton
    class SdkManager @Inject constructor() {

        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 }
        }
    }

Este exemplo mostra como obter artigos da base de conhecimento publicados usando uma consulta GraphQL.

    suspend fun loadList() = withContext(Dispatchers.IO) {
        val kbArticlesQuery = """
        { 
            GlideRecord_Query {
                kb_knowledge(queryConditions: "active=true^ORDERBYpublishedDESC"
                pagination:{ limit: 10, offset: 0 }) {
                    _results {
                        sys_id { value },
                        number { displayValue },
                        short_description { displayValue },
                        author { displayValue }
                        published { displayValue }
                    }
                }
            }
         }
     """
        val graphQLService = sdkManager.getNowGraphQLService()

        //graphQLService?.graphQLRequest(kbArticlesQuery)?.execute() can also be used
        graphQLService?.graphQLRequest(kbArticlesQuery)?.enqueue(
            { response ->
                response.body?.let {
                    val resultString = String(it)
                }

            }, { nowDataError ->
                //handle error
            })
    }

## Usando o Now TableService para interagir com ServiceNow tabelas {#mobsdk-and-interact_data_instance__section_fgn_gy2_hqb}

A [Interface do NowTableService - Android](https://servicenow-prod.fluidtopics.net/fUrMK0ElObelmDBouKY1zw#NowTableServiceAndroidInterface "A interface do NowTableService fornece funções que permitem criar, ler, excluir e atualizar registros em uma tabela em uma ServiceNow instância.") classe NowTableService fornece métodos para executar operações de CRUD nos registros em tabelas que residem em sua ServiceNow instância. Através desta interface, você pode acessar diretamente qualquer um dos registros em qualquer ServiceNow tabela para a qual o usuário conectado esteja autorizado. O NowTableService oferece suporte à referência com pontos para campos de referência. Por exemplo, se uma tabela contiver uma referência à tabela Usuário, o valor com referência `a pontos user.name` retornará o nome do usuário.

Ao retornar os dados solicitados, todas as listas de controle de acesso (ACLs) aplicáveis são aplicadas aos dados, o que pode resultar em menos resultados do que o esperado ou erros de autorização se o usuário autenticado não tiver direitos de acesso à tabela especificada.  
O exemplo a seguir mostra como importar a estrutura NowData e inicializar um objeto NowTableServce que você pode usar para interagir com ServiceNow tabelas de instância.

    /**
     * Helper class used to handle different Now service instances. It has an application scope or is Singleton
     */
    @Singleton
    class SdkManager @Inject constructor() {

        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 }
        }
     }    


    suspend fun loadCases() = withContext(Dispatchers.IO) {
        val tableService = sdkManager.getNowTableService()

        //configure what data to pass back
        val fetchConfiguration =  FetchConfiguration(Filter("active=true"), 10)

        val response = runCatching {
            tableService?.records(
                "sn_customerservice_case",
                fetchConfiguration
            )?.execute()
        }

        if (response.isSuccess) {
            val resultString = response.getOrNull()?.body?.let { String(it) }
        } else {
            //handle unsuccessful result
        }
    }

Para obter exemplos de código adicionais usando os métodos disponíveis do Now TableService, consulte a [Interface do NowTableService - Android](https://servicenow-prod.fluidtopics.net/fUrMK0ElObelmDBouKY1zw#NowTableServiceAndroidInterface "A interface do NowTableService fornece funções que permitem criar, ler, excluir e atualizar registros em uma tabela em uma ServiceNow instância.") documentação da API do Now TableService.

