Lea y revise la documentación de Automation Anywhere

Automation 360

Cerrar contenidos

Contenidos

Abrir contenidos

Configure a credential with attribute values using API

  • Actualizado: 2021/12/16
    • Automation 360 v.x
    • Explorar
    • Espacio de trabajo de RPA

Configure a credential with attribute values using API

Create a credential with a standard attribute and add two additional attributes with user-input values.

Antes de empezar

Nota: Puede ver el Control Room APIs en el Community Editionpero la funcionalidad de la API es limitada. Necesita una licencia Automation 360 Edition para acceder a toda la funcionalidad de las APIs.
  • Todas las llamadas a la API deben contener un token de autenticación en la cabecera de la solicitud. Utilizar la Autenticación para generar un token web JSON. Véase API de autenticación.
  • All roles have the Manage my credentials and lockers permission that is necessary to configure credentials and attributes. No additional permissions are necessary to use this endpoint.
In this example, you configure a credential with three attributes to hold email hostname, username, and password.

Procedimiento

  1. Añade el token de autenticación a la cabecera de la solicitud.

Create a credential:

  1. Utilice el método POST y la URL del punto final: <your_control_room_url>/v2/credentialvault/credentials.
    Request body: This example request includes the following required parameters:
    • userProvided: a boolean value that configures whether the attribute requires a user's input (true) or is standard for all users (false).
    • masked: a boolean value that configures whether the attribute value is masked with asterisks (true) or is visible to users (false).
    {
      "name": "Email",
      "attributes": [
      	{
          "name": "hostname",
          "userProvided": false,
          "masked": false
        } 	
      ]
    }
  2. Envía la solicitud.
    Response body: In a successful request, this endpoint returns the following data:
    • id: a unique numeric identifier for the credential.
    • attributes:id: a unique numeric identifier for attribute.
    {
        "id": "1630",
        "name": "Email",
        "description": "",
        "ownerId": "1508",
        "attributes": [
            {
                "id": "3335",
                "name": "hostname",
                "description": "",
                "userProvided": false,
                "masked": false,
                "createdBy": "1508",
                "createdOn": "2020-12-28T22:04:41.366448Z",
                "updatedBy": "1508",
                "updatedOn": "2020-12-28T22:04:41.366450Z",
                "version": "0",
                "passwordFlag": false
            }
        ],
        "createdBy": "1508",
        "createdOn": "2020-12-28T22:04:41.366460Z",
        "updatedBy": "1508",
        "updatedOn": "2020-12-28T22:04:41.366464Z",
        "version": "0"
    }
    La API REST responde a cada solicitud con un código de respuesta HTTP.Para los códigos de respuesta, véase Códigos de respuesta de la API.

Assign a standard value to the hostname attribute to the credential:

  1. Utilice el método POST y la URL del punto final:<your_control_room_url>/v2/credentialvault/credentials/{credentialId}/attributevalues.
    {
      "list": [
        {
          "credentialAttributeId": "3335",
          "value": "mail.example.com"
        }
      ]
    }
  2. Envía la solicitud.
    Response body:
    {
      "list": [
        {
          "id": "1630",
          "credentialAttributeId": "3335",
          "value": "mail.example.com",
          "userId": "1508",
          "createdBy": "1508",
          "createdOn": "2020-12-28T22:04:41.366460Z",
          "updatedBy": "1508",
          "updatedOn": "2020-12-28T22:04:41.366464Z",
          "version": "0"
        }
      ]
    }
  3. Add the username and password attributes to the Email credential. Utilice el método PUT y la URL del punto final:<your_control_room_url>/v2/credentialvault/credentials/{credentialId}.
    Nota: You must include the existing attributes along with the new attributes in the request, otherwise the current attributes will be overwritten.
    Request body: Since you have specified the credential ID in the request URL, it is not required to include the credential ID or name in the request body. In this example request body, the username and password attributes are configured with values that accept a different input from each user. Additionally, the password attribute is configured to mask the entered value with asterisks.
    {
        "attributes": [
      	{
          "name": "username",
          "userProvided": true,
          "masked": false
        },
         {
          "name": "password",
          "userProvided": true,
          "masked": true
        },
         {
          "name": "hostname",
          "userProvided": false,
          "masked": false
        } 		
      ]
    }
  4. Envía la solicitud.
    Response body: The response body returns the credential with details of the three attributes.
    {
        "id": "1630",
        "name": "Email",
        "description": "",
        "ownerId": "1508",
        "attributes": [
            {
                "id": "3335",
                "name": "hostname",
                "description": "",
                "userProvided": false,
                "masked": false,
                "createdBy": "1508",
                "createdOn": "2020-12-28T22:04:41.366448Z",
                "updatedBy": "1508",
                "updatedOn": "2020-12-28T22:04:41.366450Z",
                "version": "0",
                "passwordFlag": false
            },
            {
                "id": "3336",
                "name": "username",
                "description": "",
                "userProvided": true,
                "masked": false,
                "createdBy": "1508",
                "createdOn": "2020-12-28T22:04:41.366450Z",
                "updatedBy": "1508",
                "updatedOn": "2020-12-28T22:04:41.366450Z",
                "version": "0",
                "passwordFlag": false
            },
            {
                "id": "3337",
                "name": "password",
                "description": "",
                "userProvided": true,
                "masked": true,
                "createdBy": "1508",
                "createdOn": "2020-12-28T22:04:41.366450Z",
                "updatedBy": "1508",
                "updatedOn": "2020-12-28T22:04:41.366450Z",
                "version": "0",
                "passwordFlag": false
            }
        ],
        "createdBy": "1508",
        "createdOn": "2020-12-28T22:04:41.366460Z",
        "updatedBy": "1508",
        "updatedOn": "2020-12-28T22:06:35.366464Z",
        "version": "2"
    }

Qué hacer a continuación

If you are following the steps to configure your Credential Vault, do this next: Asignar credencial a locker API.
Enviar comentarios