communications-mining
latest
false
Importante :
Este contenido se ha traducido mediante traducción automática.
Guía para desarrolladores de Communications Mining
Last updated 3 de oct. de 2024

Comentarios

Añadir o actualizar comentarios

/api/v1/sources/<project>/<source_name>/sync

Permisos necesarios: Editar mensajes.

Importante:

Operación facturable

Se le cobrará 1 AI Unit por comentario creado o por comentario actualizado (en función de su Id. único) si se modificó el texto.

  • Bash
    curl -X POST 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "comments": [
        {
          "id": "0123456789abcdef",
          "messages": [
            {
              "body": {
                "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
              },
              "from": "bob@organisation.org",
              "sent_at": "2011-12-11T11:05:10.000000+00:00",
              "subject": {
                "text": "Today'"'"'s figures"
              },
              "to": [
                "alice@company.com"
              ]
            }
          ],
          "timestamp": "2011-12-11T11:05:10.000000+00:00",
          "user_properties": {
            "string:Recipient Domain": "company.com",
            "string:Sender Domain": "organisation.org"
          }
        },
        {
          "id": "abcdef0123456789",
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice"
              },
              "from": "alice@company.com",
              "sent_at": "2011-12-11T11:18:43.000000+00:00",
              "subject": {
                "text": "Today'"'"'s figures"
              },
              "to": [
                "bob@organisation.org"
              ]
            }
          ],
          "timestamp": "2011-12-11T11:18:43.000000+00:00",
          "user_properties": {
            "string:Recipient Domain": "organisation.org",
            "string:Sender Domain": "company.com"
          }
        }
      ]
    }'curl -X POST 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "comments": [
        {
          "id": "0123456789abcdef",
          "messages": [
            {
              "body": {
                "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
              },
              "from": "bob@organisation.org",
              "sent_at": "2011-12-11T11:05:10.000000+00:00",
              "subject": {
                "text": "Today'"'"'s figures"
              },
              "to": [
                "alice@company.com"
              ]
            }
          ],
          "timestamp": "2011-12-11T11:05:10.000000+00:00",
          "user_properties": {
            "string:Recipient Domain": "company.com",
            "string:Sender Domain": "organisation.org"
          }
        },
        {
          "id": "abcdef0123456789",
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice"
              },
              "from": "alice@company.com",
              "sent_at": "2011-12-11T11:18:43.000000+00:00",
              "subject": {
                "text": "Today'"'"'s figures"
              },
              "to": [
                "bob@organisation.org"
              ]
            }
          ],
          "timestamp": "2011-12-11T11:18:43.000000+00:00",
          "user_properties": {
            "string:Recipient Domain": "organisation.org",
            "string:Sender Domain": "company.com"
          }
        }
      ]
    }'
    
  • Nodo
    const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          comments: [
            {
              id: "0123456789abcdef",
              messages: [
                {
                  body: {
                    text: "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob",
                  },
                  from: "bob@organisation.org",
                  sent_at: "2011-12-11T11:05:10.000000+00:00",
                  subject: { text: "Today's figures" },
                  to: ["alice@company.com"],
                },
              ],
              timestamp: "2011-12-11T11:05:10.000000+00:00",
              user_properties: {
                "string:Recipient Domain": "company.com",
                "string:Sender Domain": "organisation.org",
              },
            },
            {
              id: "abcdef0123456789",
              messages: [
                {
                  body: {
                    text: "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice",
                  },
                  from: "alice@company.com",
                  sent_at: "2011-12-11T11:18:43.000000+00:00",
                  subject: { text: "Today's figures" },
                  to: ["bob@organisation.org"],
                },
              ],
              timestamp: "2011-12-11T11:18:43.000000+00:00",
              user_properties: {
                "string:Recipient Domain": "organisation.org",
                "string:Sender Domain": "company.com",
              },
            },
          ],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          comments: [
            {
              id: "0123456789abcdef",
              messages: [
                {
                  body: {
                    text: "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob",
                  },
                  from: "bob@organisation.org",
                  sent_at: "2011-12-11T11:05:10.000000+00:00",
                  subject: { text: "Today's figures" },
                  to: ["alice@company.com"],
                },
              ],
              timestamp: "2011-12-11T11:05:10.000000+00:00",
              user_properties: {
                "string:Recipient Domain": "company.com",
                "string:Sender Domain": "organisation.org",
              },
            },
            {
              id: "abcdef0123456789",
              messages: [
                {
                  body: {
                    text: "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice",
                  },
                  from: "alice@company.com",
                  sent_at: "2011-12-11T11:18:43.000000+00:00",
                  subject: { text: "Today's figures" },
                  to: ["bob@organisation.org"],
                },
              ],
              timestamp: "2011-12-11T11:18:43.000000+00:00",
              user_properties: {
                "string:Recipient Domain": "organisation.org",
                "string:Sender Domain": "company.com",
              },
            },
          ],
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "comments": [
                {
                    "id": "0123456789abcdef",
                    "timestamp": "2011-12-11T11:05:10.000000+00:00",
                    "messages": [
                        {
                            "from": "bob@organisation.org",
                            "to": ["alice@company.com"],
                            "sent_at": "2011-12-11T11:05:10.000000+00:00",
                            "subject": {"text": "Today's figures"},
                            "body": {
                                "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
                            },
                        }
                    ],
                    "user_properties": {
                        "string:Sender Domain": "organisation.org",
                        "string:Recipient Domain": "company.com",
                    },
                },
                {
                    "id": "abcdef0123456789",
                    "timestamp": "2011-12-11T11:18:43.000000+00:00",
                    "messages": [
                        {
                            "from": "alice@company.com",
                            "to": ["bob@organisation.org"],
                            "sent_at": "2011-12-11T11:18:43.000000+00:00",
                            "subject": {"text": "Today's figures"},
                            "body": {
                                "text": "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice"
                            },
                        }
                    ],
                    "user_properties": {
                        "string:Sender Domain": "company.com",
                        "string:Recipient Domain": "organisation.org",
                    },
                },
            ]
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "comments": [
                {
                    "id": "0123456789abcdef",
                    "timestamp": "2011-12-11T11:05:10.000000+00:00",
                    "messages": [
                        {
                            "from": "bob@organisation.org",
                            "to": ["alice@company.com"],
                            "sent_at": "2011-12-11T11:05:10.000000+00:00",
                            "subject": {"text": "Today's figures"},
                            "body": {
                                "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
                            },
                        }
                    ],
                    "user_properties": {
                        "string:Sender Domain": "organisation.org",
                        "string:Recipient Domain": "company.com",
                    },
                },
                {
                    "id": "abcdef0123456789",
                    "timestamp": "2011-12-11T11:18:43.000000+00:00",
                    "messages": [
                        {
                            "from": "alice@company.com",
                            "to": ["bob@organisation.org"],
                            "sent_at": "2011-12-11T11:18:43.000000+00:00",
                            "subject": {"text": "Today's figures"},
                            "body": {
                                "text": "Hi Bob,\n\nI think these are the wrong numbers - could you check?\n\nThanks again,\nAlice"
                            },
                        }
                    ],
                    "user_properties": {
                        "string:Sender Domain": "company.com",
                        "string:Recipient Domain": "organisation.org",
                    },
                },
            ]
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Respuesta
    {
      "new": 2,
      "status": "ok",
      "unchanged": 0,
      "updated": 0
    }{
      "new": 2,
      "status": "ok",
      "unchanged": 0,
      "updated": 0
    }

El ID de un comentario lo identifica de forma única dentro de una fuente. Si el ID de comentario proporcionado no existe en el origen, se crea un nuevo comentario. De lo contrario, se actualiza un comentario existente.

NombreTipoObligatorioDescripción
commentsarray<Cmment>Un lote de 16 384 comentarios como máximo, en el formato descrito en la Referencia de comentarios. Los lotes más grandes son más rápidos (por comentario) que los más pequeños.

CAMPOS GENERALES ASIGNADOS

Los campos generales asignados se conservarán, a menos que el texto cambie significativamente. Las etiquetas asignadas nunca se descartan.

SOLICITUDES GRANDES

Para solicitudes grandes, este punto final puede tardar más en responder. Debe aumentar el tiempo de espera de su cliente.

Añadir o actualizar comentarios de correos electrónicos sin procesar

/api/v1/sources/<project>/<source_name>/sync-raw-emails

Permisos necesarios: Editar mensajes

Importante:

Operación facturable

Se te cobrará 1 unidad de IA por comentario creado, o por comentario actualizado (basado en el ID del mensaje del correo electrónico) si se ha modificado su texto.

  • Bash
    curl -X POST 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "raw_email": {
            "body": {
              "plain": "Hi Bob,\n\nCould you send me today'"'"'s figures?\n\nThanks,\nAlice"
            },
            "headers": {
              "parsed": {
                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                "From": "alice@company.com",
                "Message-ID": "abcdef@company.com",
                "References": "<01234@company.com> <56789@company.com>",
                "Subject": "Figures Request",
                "To": "bob@organisation.org"
              }
            }
          },
          "user_properties": {
            "number:Deal Value": 12000,
            "string:City": "London"
          }
        }
      ],
      "include_comments": true,
      "transform_tag": "name.0.ABCD1234"
    }'curl -X POST 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails' \
        -H "Authorization: Bearer $REINFER_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
      "documents": [
        {
          "raw_email": {
            "body": {
              "plain": "Hi Bob,\n\nCould you send me today'"'"'s figures?\n\nThanks,\nAlice"
            },
            "headers": {
              "parsed": {
                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                "From": "alice@company.com",
                "Message-ID": "abcdef@company.com",
                "References": "<01234@company.com> <56789@company.com>",
                "Subject": "Figures Request",
                "To": "bob@organisation.org"
              }
            }
          },
          "user_properties": {
            "number:Deal Value": 12000,
            "string:City": "London"
          }
        }
      ],
      "include_comments": true,
      "transform_tag": "name.0.ABCD1234"
    }'
    
  • Nodo
    const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              raw_email: {
                body: {
                  plain:
                    "Hi Bob,\n\nCould you send me today's figures?\n\nThanks,\nAlice",
                },
                headers: {
                  parsed: {
                    Date: "Thu, 09 Jan 2020 16:34:45 +0000",
                    From: "alice@company.com",
                    "Message-ID": "abcdef@company.com",
                    References: "<01234@company.com> <56789@company.com>",
                    Subject: "Figures Request",
                    To: "bob@organisation.org",
                  },
                },
              },
              user_properties: {
                "number:Deal Value": 12000,
                "string:City": "London",
              },
            },
          ],
          include_messages: true,
          transform_tag: "name.0.ABCD1234",
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.post(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
        json: true,
        body: {
          documents: [
            {
              raw_email: {
                body: {
                  plain:
                    "Hi Bob,\n\nCould you send me today's figures?\n\nThanks,\nAlice",
                },
                headers: {
                  parsed: {
                    Date: "Thu, 09 Jan 2020 16:34:45 +0000",
                    From: "alice@company.com",
                    "Message-ID": "abcdef@company.com",
                    References: "<01234@company.com> <56789@company.com>",
                    Subject: "Figures Request",
                    To: "bob@organisation.org",
                  },
                },
              },
              user_properties: {
                "number:Deal Value": 12000,
                "string:City": "London",
              },
            },
          ],
          include_messages: true,
          transform_tag: "name.0.ABCD1234",
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "transform_tag": "name.0.ABCD1234",
            "documents": [
                {
                    "raw_email": {
                        "headers": {
                            "parsed": {
                                "Message-ID": "abcdef@company.com",
                                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                                "Subject": "Figures Request",
                                "From": "alice@company.com",
                                "To": "bob@organisation.org",
                                "References": "<01234@company.com> <56789@company.com>",
                            }
                        },
                        "body": {
                            "plain": "Hi Bob,\n\nCould you send me today's figures?\n\nThanks,\nAlice"
                        },
                    },
                    "user_properties": {
                        "string:City": "London",
                        "number:Deal Value": 12000,
                    },
                }
            ],
            "include_comments": True,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.post(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/sync-raw-emails",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
        json={
            "transform_tag": "name.0.ABCD1234",
            "documents": [
                {
                    "raw_email": {
                        "headers": {
                            "parsed": {
                                "Message-ID": "abcdef@company.com",
                                "Date": "Thu, 09 Jan 2020 16:34:45 +0000",
                                "Subject": "Figures Request",
                                "From": "alice@company.com",
                                "To": "bob@organisation.org",
                                "References": "<01234@company.com> <56789@company.com>",
                            }
                        },
                        "body": {
                            "plain": "Hi Bob,\n\nCould you send me today's figures?\n\nThanks,\nAlice"
                        },
                    },
                    "user_properties": {
                        "string:City": "London",
                        "number:Deal Value": 12000,
                    },
                }
            ],
            "include_comments": True,
        },
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Respuesta
    {
      "comments": [
        {
          "attachments": [],
          "id": "61626364656640636f6d70616e792e636f6d",
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nCould you send me today's figures?"
              },
              "from": "alice@company.com",
              "sent_at": "2020-01-09T16:34:45Z",
              "signature": {
                "text": "Thanks,\nAlice"
              },
              "subject": {
                "text": "Figures Request"
              },
              "to": ["bob@organisation.org"]
            }
          ],
          "source_id": "c1fb849b855841de",
          "text_format": "plain",
          "thread_id": "3c303132333440636f6d70616e792e636f6d3e",
          "timestamp": "2020-01-09T16:34:45Z",
          "uid": "c1fb849b855841de.61626364656640636f6d70616e792e636f6d",
          "user_properties": {
            "number:Deal Value": 12000,
            "number:Participant Count": 2,
            "number:Position in Thread": 3,
            "number:Recipient Count": 1,
            "string:City": "London",
            "string:Has Signature": "Yes",
            "string:Message ID": "abcdef@company.com",
            "string:Sender": "alice@company.com",
            "string:Sender Domain": "company.com",
            "string:Thread": "<01234@company.com>"
          }
        }
      ],
      "new": 1,
      "status": "ok",
      "unchanged": 0,
      "updated": 0
    }{
      "comments": [
        {
          "attachments": [],
          "id": "61626364656640636f6d70616e792e636f6d",
          "messages": [
            {
              "body": {
                "text": "Hi Bob,\n\nCould you send me today's figures?"
              },
              "from": "alice@company.com",
              "sent_at": "2020-01-09T16:34:45Z",
              "signature": {
                "text": "Thanks,\nAlice"
              },
              "subject": {
                "text": "Figures Request"
              },
              "to": ["bob@organisation.org"]
            }
          ],
          "source_id": "c1fb849b855841de",
          "text_format": "plain",
          "thread_id": "3c303132333440636f6d70616e792e636f6d3e",
          "timestamp": "2020-01-09T16:34:45Z",
          "uid": "c1fb849b855841de.61626364656640636f6d70616e792e636f6d",
          "user_properties": {
            "number:Deal Value": 12000,
            "number:Participant Count": 2,
            "number:Position in Thread": 3,
            "number:Recipient Count": 1,
            "string:City": "London",
            "string:Has Signature": "Yes",
            "string:Message ID": "abcdef@company.com",
            "string:Sender": "alice@company.com",
            "string:Sender Domain": "company.com",
            "string:Thread": "<01234@company.com>"
          }
        }
      ],
      "new": 1,
      "status": "ok",
      "unchanged": 0,
      "updated": 0
    }

Cada correo electrónico sin procesar se convertirá en un comentario de Communications Mining. Communications Mining generará el ID del comentario en función del encabezado "Message-ID" del correo electrónico. Si no existe un comentario con este ID de comentario en el origen, se creará un nuevo comentario. De lo contrario, se actualizará un comentario existente.

Al convertir un correo electrónico sin formato en un comentario, Communications Mining limpiará el cuerpo del correo electrónico y generará metadatos a partir de los encabezados de correo electrónico. Puedes establecer include_comments como true para incluir los comentarios generados en la respuesta. Los comentarios se devolverán en el formato descrito en la Referencia de comentarios.
NombreTipoObligatorioDescripción
transform_tagStringUna etiqueta que identifica la integración de correo electrónico que envía los datos. Debería haber recibido esta etiqueta durante la configuración de la integración.
documentsarray<Document>Un lote de un máximo de 16 384 documentos en el formato descrito a continuación. Los lotes más grandes son más rápidos (por documento) que los más pequeños.
include_commentsBooleanoNoSi se establece en true, los comentarios analizados de los correos electrónicos se devolverán en el cuerpo de la respuesta.
override_user_propertiesarray<string>NoLas propiedades de usuario proporcionadas en documents anularán las propiedades de usuario generadas automáticamente si sus nombres aparecen en esta lista. Los nombres de propiedad de usuario en esta lista deben especificarse sin el prefijo de tipo , por ejemplo, como My Property y no string:My Property.

Donde Document tiene el siguiente formato:

NombreTipoObligatorioDescripción
raw_emailRawEmailDatos de correo electrónico, en el formato descrito en la Referencia de comentarios.
comment_idStringNoIdentifica de forma única un comentario. Si no se proporciona un ID de comentario, Communications Mining generará el ID de comentario a partir del ID de mensaje del correo electrónico. El formato se describe en la Referencia de comentarios.
user_propertiesmap<string, string | number>NoCualquier metadato definido por el usuario que se aplique al comentario. El formato se describe en la Referencia de comentarios.
Nota: Algunas propiedades de usuario se generan en función del contenido del correo electrónico. Si estos entran en conflicto con las propiedades de usuario cargadas, la solicitud fallará con 422 Unprocessable Entity.
ADVERTENCIA:

CAMPOS GENERALES ASIGNADOS

Communications Mining generará el contenido de los "mensajes" del comentario a partir del cuerpo del correo electrónico sin procesar y un subconjunto de los encabezados del correo electrónico sin procesar, teniendo en cuenta la etiqueta de transformación especificada. Los campos generales asignados se conservarán, a menos que el texto cambie significativamente. Las etiquetas asignadas nunca se descartan.

Importante:

SOLICITUDES GRANDES

Para solicitudes grandes, este punto final puede tardar más en responder. Debe aumentar el tiempo de espera de su cliente.

Eliminar comentarios

/api/v1/sources/<project>/<source_name>/comments?id=<comment_id0>[&id=<comment_id1>...]

Permisos necesarios: Editar mensajes

  • Bash
    curl -X DELETE 'https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X DELETE 'https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • Nodo
    const request = require("request");
    
    request.delete(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.delete(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.delete(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.delete(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source_name>/comments?id=abcdef0123456789",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Respuesta
    {
      "status": "ok"
    }{
      "status": "ok"
    }

Los comentarios individuales pueden eliminarse de una fuente, utilizando el ID proporcionado cuando se añadió el comentario.

Todos los datos asociados a este comentario se eliminarán de forma permanente.

Obtener un comentario por ID

/api/v1/sources/<project>/<source_name>/comments/<comment_id>

Permisos necesarios: ver fuentes

  • Bash
    curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • Nodo
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/comments/0123456789abcdef",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Respuesta
    {
      "comment": {
        "context": "1596721237668",
        "created_at": "2020-08-06T13:20:28.531000Z",
        "id": "0123456789abcdef",
        "last_modified": "2020-08-06T13:40:37.668000Z",
        "messages": [
          {
            "body": {
              "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
            },
            "from": "bob@organisation.org",
            "sent_at": "2011-12-11T11:05:10Z",
            "subject": {
              "text": "Today's figures"
            },
            "to": ["alice@company.com"]
          }
        ],
        "source_id": "47194279497e141e",
        "text_format": "plain",
        "timestamp": "2011-12-11T11:05:10Z",
        "uid": "47194279497e141e.0123456789abcdef",
        "user_properties": {
          "string:Recipient Domain": "company.com",
          "string:Sender Domain": "organisation.org"
        }
      },
      "status": "ok"
    }{
      "comment": {
        "context": "1596721237668",
        "created_at": "2020-08-06T13:20:28.531000Z",
        "id": "0123456789abcdef",
        "last_modified": "2020-08-06T13:40:37.668000Z",
        "messages": [
          {
            "body": {
              "text": "Alice,\n\nHere are the figures for today.\n\nRegards,\nBob"
            },
            "from": "bob@organisation.org",
            "sent_at": "2011-12-11T11:05:10Z",
            "subject": {
              "text": "Today's figures"
            },
            "to": ["alice@company.com"]
          }
        ],
        "source_id": "47194279497e141e",
        "text_format": "plain",
        "timestamp": "2011-12-11T11:05:10Z",
        "uid": "47194279497e141e.0123456789abcdef",
        "user_properties": {
          "string:Recipient Domain": "company.com",
          "string:Sender Domain": "organisation.org"
        }
      },
      "status": "ok"
    }

El comentario se devolverá en el formato descrito en la Referencia de comentarios.

Obtener comentarios por ID de hilo

/api/v1/sources/<project>/<source_name>/threads?id=<thread_id0>[&id=<thread_id1>...]

Permisos necesarios: ver fuentes

  • Bash
    curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162' \
        -H "Authorization: Bearer $REINFER_TOKEN"curl -X GET 'https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162' \
        -H "Authorization: Bearer $REINFER_TOKEN"
    
  • Nodo
    const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );const request = require("request");
    
    request.get(
      {
        url: "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162",
        headers: {
          Authorization: "Bearer " + process.env.REINFER_TOKEN,
        },
      },
      function (error, response, json) {
        // digest response
        console.log(JSON.stringify(json, null, 2));
      }
    );
  • Python
    import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))import json
    import os
    
    import requests
    
    response = requests.get(
        "https://<my_api_endpoint>/api/v1/sources/<project>/<source>/threads?id=185521538102&id=81745162",
        headers={"Authorization": "Bearer " + os.environ["REINFER_TOKEN"]},
    )
    
    print(json.dumps(response.json(), indent=2, sort_keys=True))
    
  • Respuesta
    {
      "status": "ok",
      "threads": [
        {
          "messages": ["4321dcba.1234", "4321dcba.2345", "4321dcba.3456"],
          "thread_id": "185521538102"
        },
        {
          "messages": [],
          "thread_id": "81745162"
        }
      ]
    }{
      "status": "ok",
      "threads": [
        {
          "messages": ["4321dcba.1234", "4321dcba.2345", "4321dcba.3456"],
          "thread_id": "185521538102"
        },
        {
          "messages": [],
          "thread_id": "81745162"
        }
      ]
    }
Para cada ID de hilo especificado, la respuesta contendrá una lista de UID de comentarios (en el formato de source_id.comment_id) que pertenecen a ese hilo. Ten en cuenta que no obtendrás un error si proporcionas un ID de hilo que no existe; en su lugar, la lista correspondiente de comentarios en la respuesta estará vacía.

¿Te ha resultado útil esta página?

Obtén la ayuda que necesitas
RPA para el aprendizaje - Cursos de automatización
Foro de la comunidad UiPath
Uipath Logo White
Confianza y seguridad
© 2005-2024 UiPath. Todos los derechos reservados.