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


---

# ConnectionInfo : champ d'application, global

# ConnectionInfo : champ d'application, global {#ariaid-title1}

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

L'API ConnectionInfo vous permet d'obtenir des informations d'attribut de connexion via l'alias de connexion et d'informations d'identification.

Vous pouvez utiliser cette API dans les applications incluses dans le périmètre ou dans le périmètre global. Dans les scripts inclus dans le champ d'application, utilisez l'identificateur `d'espace` de noms sn_cc.

Pour plus d'informations sur les connexions et les informations [d'identification, consultez Informations d'identification et informations de connexion](https://www.servicenow.com/docs/access?context=r-credentials&version=xanadu&pubname=xanadu-platform-security&ft:locale=en-US).

Cette fonction récupère les informations d'attribut de connexion identifiées par l'alias de connexion et d'informations d'identification donné.  

    var provider = new sn_cc.ConnectionInfoProvider();

    // get a jdbc connection in the current domain with the alias ID
    //     "6219afbf9f03320021dd7501942e70fc"
    var connectionInfo = provider.getConnectionInfo("6219afbf9f03320021dd7501942e70fc");
    if (connectionInfo != null) {
      // get data map
      var datamap = connectionInfo.getDataMap();
      gs.info(datamap["name"]);
      gs.info(datamap["connection_url"]);

      // get the same values using getAttribute
      gs.info(connectionInfo.getAttribute("name"));
      gs.info(connectionInfo.getAttribute("connection_url"));

      // get credential attributes
      gs.info(connectionInfo.getCredentialAttribute("user_name"));
      gs.info(connectionInfo.getCredentialAttribute("password")); 

      // get extended attributes
      var extendedAttributes = connectionInfo.getExtendedAttributes();  
      gs.info(extendedAttributes["name1"]);
     }

     // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");
     if (connectionInfo != null) {
       // get data map
       var datamap = connectionInfo.getDataMap();
       gs.info(datamap["name"]);
     }

## ConnectionInfo inclus dans le périmètre : getAttribute (nom de chaîne) {#ariaid-title2}

Renvoie la valeur d'un attribut ConnectionInfo avec le nom de propriété spécifié.
{#CI-getAttribute_S__table_ext_cx2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| nom | Chaîne | Nom d'une propriété d'objet ConnectionInfo . |
[Tableau 1. Paramètres]

{#CI-getAttribute_S__table_ext_cx2_qbb} {#CI-getAttribute_S__table_fxt_cx2_qbb__entry__2}

| Type | Description |
|-|-|
| Chaîne | Valeur d'une propriété ConnectionInfo spécifiée. |
[Tableau 2. Renvoie]

{#CI-getAttribute_S__table_fxt_cx2_qbb}  

      // get the same values using getAttribute
      gs.info(connectionInfo.getAttribute("name"));
      gs.info(connectionInfo.getAttribute("connection_url"));

## ConnectionInfo incluse dans le périmètre : getCredentialAttribute() {#ariaid-title3}

Renvoie la valeur des attributs d'informations d'identification pour une connexion spécifiée.
{#CI-getCredentialAttribute_S__table_ext_cx2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucun |   |   |
[Tableau 3. Paramètres]

{#CI-getCredentialAttribute_S__table_ext_cx2_qbb} {#CI-getCredentialAttribute_S__table_fxt_cx2_qbb__entry__2}

| Type | Description |
|-|-|
| Objet | Carte de paires clé-valeur des attributs d'informations d'identification. |
[Tableau 4. Renvoie]

{#CI-getCredentialAttribute_S__table_fxt_cx2_qbb}  

     // get credential attributes
      gs.info(connectionInfo.getCredentialAttribute("user_name"));
      gs.info(connectionInfo.getCredentialAttribute("password")); 

## ConnectionInfo incluse dans le périmètre : getDataMap() {#ariaid-title4}

Renvoie les attributs de connexion sous la forme d'une collection de paires clé-valeur.
{#CI-getDataMap_S__table_ext_cx2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucun |   |   |
[Tableau 5. Paramètres]

{#CI-getDataMap_S__table_ext_cx2_qbb} {#CI-getDataMap_S__table_fxt_cx2_qbb__entry__2}

| Type | Description |
|-|-|
| Objet | Carte de paires clé-valeur des attributs de connexion. |
[Tableau 6. Renvoie]

{#CI-getDataMap_S__table_fxt_cx2_qbb}  

     // get data map
      var datamap = connectionInfo.getDataMap();
      gs.info(datamap["name"]);
      gs.info(datamap["connection_url"]);

## ConnectionInfo incluse dans le périmètre : getExtendedAttributes() {#ariaid-title5}

Renvoie les attributs étendus sous la forme d'une collection de paires clé-valeur.
{#CI-getExtendedAttributes_S__table_ext_cx2_qbb__entry__3}

| Nom | Type | Description |
|-|-|-|
| Aucun |   |   |
[Tableau 7. Paramètres]

{#CI-getExtendedAttributes_S__table_ext_cx2_qbb} {#CI-getExtendedAttributes_S__table_fxt_cx2_qbb__entry__2}

| Type | Description |
|-|-|
| Objet | Carte de paires clé-valeur des attributs étendus. |
[Tableau 8. Renvoie]

{#CI-getExtendedAttributes_S__table_fxt_cx2_qbb}  

    // get extended attributes
      var extendedAttributes = connectionInfo.getExtendedAttributes();  
      gs.info(extendedAttributes["name1"]);
     }


