---
sourceDocument: Référence de l’API Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence de l’API Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe NowDataSDK : Android

# Classe NowDataSDK : Android {#ariaid-title1}

* Rversion finale: Xanadu
* 
* Mis à jour 1 août 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes de lecture

La classe NowDataSDK fournit des fonctions qui permettent la création et l'initialisation de divers services de fonctionnalités tels que NowGraphQLService, NowAttachmentService, NowTableService et NowAPIService.

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

Crée et initialise une instance de la fonctionnalité NowGraphQLService. Ce service permet d'accéder à l'API GraphQL sur votre ServiceNow instance.
Pour plus d'informations sur l'API ServiceNow GraphQL, consultez [Interroger les données des enregistrements à l'aide du cadre de travail de l'API GraphQL](https://servicenow-prod.fluidtopics.net/DxKJxnuEnkDHT2ptT5e55A "Créez une API GraphQL personnalisée pour interroger les données d’enregistrement à partir d’un composant ou d’un système tiers.").
{#NDataSDK-makeGraphQLService_S_O_O__table_nvx_zbt_4pb__entry__3}

| Nom | Type | Description |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL de l'instance ServiceNow à laquelle accéder. Par exemple, `<< https://instance.servicenow.com >>` |
[Tableau 1. Paramètres]

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

| Type | Description |
|-|-|
| Résultat\<NowGraphQLService\> | NowGraphQLService enveloppé dans un [objet de résultat Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tableau 2. Renvoie]

{#NDataSDK-makeGraphQLService_S_O_O__table_ovx_zbt_4pb}  
L'exemple de code suivant montre comment appeler cette fonction.

    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}

Crée et initialise une instance du service NowAPIService. Ce service vous permet d'accéder aux API REST publiques exposées par votre ServiceNow instance.
En outre, vous pouvez développer des API REST scriptées personnalisées au sein de votre ServiceNow instance et y accéder au sein de votre Android application à l'aide de l'API [NowAPIService](https://servicenow-prod.fluidtopics.net/1gaWh_B1G47NVk0nXBk8Tg#NowAPIServiceAndroidInterface "L’interface NowAPIService permet d’effectuer des demandes sur une API REST spécifiée ServiceNow .") . Pour en savoir plus sur les API REST, reportez-vous ServiceNow à la section [API REST basées sur un script](https://servicenow-prod.fluidtopics.net/Odc1JGpZE_Jk624lvLE_dw "La fonctionnalité d’API REST scriptée permet aux développeurs d’applications de créer des API de service Web personnalisées.").
{#NDataSDK-makeNowAPIService_S_O_O__table_rjf_lft_4pb__entry__3}

| Nom | Type | Description |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL de l'instance ServiceNow à laquelle accéder. Par exemple, `<< https://instance.servicenow.com >>` |
[Tableau 3. Paramètres]

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

| Type | Description |
|-|-|
| Résultat \<NowAPIService\> | NowAPIService enveloppé dans un [objet de résultat Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tableau 4. Renvoie]

{#NDataSDK-makeNowAPIService_S_O_O__table_sjf_lft_4pb}  
L'exemple de code suivant montre comment appeler cette fonction.

    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}

Crée et initialise une instance de la fonctionnalité NowAttachmentService.
Ce service vous permet de charger, de télécharger et de supprimer des fichiers en pièce jointe de votre ServiceNow instance. Une fois que vous avez chargé une pièce jointe sur votre instance, elle génère des métadonnées pour la pièce jointe que vous pouvez ensuite télécharger dans votre Android application.

Pour en savoir plus sur les pièces jointes, reportez-vous ServiceNow à la section [API de pièce jointe](https://servicenow-prod.fluidtopics.net/l0hrYA0GJ_q5yhPiWJa~bw#c_AttachmentAPI "L’API de pièces jointes fournit des points de terminaison qui vous permettent de charger et d’interroger des pièces jointes.").
{#NDataSDK-makeNowAttachService_S_O_O__table_bnd_qgt_4pb__entry__3}

| Nom | Type | Description |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL de l'instance ServiceNow à laquelle accéder. Par exemple, `<< https://instance.servicenow.com >>` |
[Tableau 5. Paramètres]

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

| Type | Description |
|-|-|
| Résultat \<NowAttachmentService\> | NowAttachmentService enveloppé dans un [objet de résultat Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tableau 6. Renvoie]

{#NDataSDK-makeNowAttachService_S_O_O__table_cnd_qgt_4pb}  
L'exemple de code suivant montre comment appeler cette méthode.

    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}

Crée et initialise une instance de la fonctionnalité NowTableService.
Ce service vous permet d'accéder à l'API de table REST sur une ServiceNow instance. Pour plus d'informations sur l'API de table REST [, consultez API de table](https://servicenow-prod.fluidtopics.net/zBy0jrbF7tnEmKA3AcV0_g#c_TableAPI "L'API de table fournit des points de terminaison qui vous permettent d'effectuer des opérations de création, de lecture, de mise à jour et de suppression (CRUD) dans les tables existantes.").
{#NDataSDK-makeTableService_S_O_O__table_jxh_vht_4pb__entry__3}

| Nom | Type | Description |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL de l'instance ServiceNow à laquelle accéder. Par exemple, `<< https://instance.servicenow.com >>` |
[Tableau 7. Paramètres]

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

| Type | Description |
|-|-|
| Résultat \<NowTableService\> | Objet NowTableService enveloppé dans un [objet de résultat Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tableau 8. Renvoie]

{#NDataSDK-makeTableService_S_O_O__table_kxh_vht_4pb}  
L'exemple de code suivant montre comment appeler cette fonction.

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


