How can we help?

Export Account Monitor error logs API

Overview

The export Account Monitor error logs resource creates an export job to download and store a JSON file of Account Monitor error logs from the Cordial database. This can help you identify trends in errors.

API set name: accountmonitorexport

Additional information

  • This resource is not a collection of exports. It's a resource that initiates export processing by creating an export job.
  • Export supports JSON.
  • Export status information is available through the Jobs resource. To access the Jobs page via the UI, click on the Jobs button at the top.
  • Export files in the UI will be stored for 30 days from the date of the export.
  • Supports use of limitRecordsPerFile to define the number of records per file.

 

Authentication

Cordial's core APIs use HTTP Basic Authentication (BA). From within the Cordial platform, you can generate an encoded API key for your account and use it for authorization.

POST/v2/accountmonitorexport

Method Example URL Path
POST /v2/accountmonitorexport
Creates an export job of Account Monitor error logs using the JSON body information.

Parameters

The following parameters are listed by destination type.

  • * Required

    Parameter Type Description Example
    * name string Defines the export file name. The name may only contain letters, numbers, and dashes. If provided, this value will be displayed next to the job ID on the Jobs Widget page. "accountmonitorexport",

    destination

    * Only equired if SFTP, FTP, S3, Google Cloud Storage (GCS), or Azure Blob is used as the destination. Destination type aws should be used if the file is to be downloaded via the UI.

    object Defines the destination. See examples below.

    type

    * Only required if destination is FTP, SFTP, S3, GCS, or Azure Blob.

    string Defines the destination type. Possible values:
    aws, ftp, sftp, s3, gcs, azureblob
    "azureblob",

    path

    * Only required if destination is FTP, SFTP, S3, GCS, or Azure Blob.

    string If type is S3: path to folder and file where export will be stored. If type is FTP, SFTP, or GCS: path to folder.

    S3: "/folder/contactsExport.csv"

    FTP: "/folder"

    GCS: "/folder"

    * selected_timeframe_start string Start time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    * selected_timeframe_end string End time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    selected_category string Optional. Specifies the category to export. Possible values: API, automated messages, batch messages, data automations, exports, imports, inbound, jobs, JS listener, system "API",
    selected_level string Optional. Specifies the level to export. Possible values: Debug, info, warning, error. If no value is passed, all levels will be exported. "Error",
    limitRecordsPerFile integer Optional. Defines the number of exported records per file. If no value is passed, all records that match the filters will be exported in one file. Default is 0. "1000",
    compress boolean Optional. Compresses the exported file. If value is "true", the file is compressed using GZIP with the file extension ".gz" added to the filename. "true",
    confirmEmail  email Optional. Email address to send an alert when the export job has been completed.  "msmith@example.com",
  • * Required

    Parameter Type Description Example
    *name string Defines the export file name. The name may only contain letters, numbers, and dashes. If provided, this value will be displayed next to the job ID on the Jobs Widget page. "accountmonitorexport",

    *destination

    object Defines the destination. See example below.
    *type string Defines the destination type. "aws",
    aws_access_key_id
    * Only required if destination is S3 and IAM role is not configured.
    string Defines the public AWS id. "A1234567890",
    aws_secret_access_key
    * Only required if destination is S3 and IAM role is not configured.
    string Defines the secret AWS key. "B1234567890",
    *aws_bucket string Defines the AWS bucket name. "bucketname",
    *aws_region string Defines the AWS region. "us-west-2",

    *path

    string For S3: path to folder and file where export will be stored. S3: "/folder/contactsExport.csv",
    *selected_timeframe_start string Start time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    *selected_timeframe_end string End time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    selected_category string Optional. Specifies the category to export. Possible values: API, automated messages, batch messages, data automations, exports, imports, inbound, jobs, JS listener, system "API",
    selected_level string Optional. Specifies the level to export. Possible values: Debug, info, warning, error. If no value is passed, all levels will be exported. "Error",
    limitRecordsPerFile integer Optional. Defines the number of exported records per file. If no value is passed, all records that match the filters will be exported in one file. Default is 0. "1000",
    compress boolean Optional. Compresses the exported file. If value is "true", the file is compressed using GZIP with the file extension ".gz" added to the filename. "true",
    confirmEmail  email Optional. Email address to send an alert when the export job has been completed.  "msmith@example.com",
  • * Required

    Parameter Type Description Example
    *name string Defines the export file name. The name may only contain letters, numbers, and dashes. If provided, this value will be displayed next to the job ID on the Jobs Widget page. "accountmonitorexport",

    *destination

    object Defines the destination. See example below.
    *type string Defines the destination type. "sftp",

    *server

    string Domain or IP address of the FTP/SFTP server. "sftp.example.com",
    *port number Defines the port number for the FTP or SFTP server. "22",
    *username string Defines the username for FTP or SFTP authentication. "username",
    *password string Defines the password for FTP or SFTP authentication. "password",

    savedKey
    * Only required if using SFTP public key authentication instead of password.

    string SFTP public key authentication key name. "myKeyName",

    *path

    string Path to folder where the export file will be stored. FTP: "/folder",
    *selected_timeframe_start string Start time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    *selected_timeframe_end string End time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    selected_category string Optional. Specifies the category to export. Possible values: API, automated messages, batch messages, data automations, exports, imports, inbound, jobs, JS listener, system "API",
    selected_level string Optional. Specifies the level to export. Possible values: Debug, info, warning, error. If no value is passed, all levels will be exported. "Error",
    limitRecordsPerFile integer Optional. Defines the number of exported records per file. If no value is passed, all records that match the filters will be exported in one file. Default is 0. "1000",
    compress boolean Optional. Compresses the exported file. If value is "true", the file is compressed using GZIP with the file extension ".gz" added to the filename. "true",
    confirmEmail  email Optional. Email address to send an alert when the export job has been completed.  "msmith@example.com",
  • * Required

    Parameter Type Description Example
    *name string Defines the export file name. The name may only contain letters, numbers, and dashes. If provided, this value will be displayed next to the job ID on the Jobs Widget page. "accountmonitorexport",

    *destination

    object Defines the destination. See example below.
    *type string Defines the destination type. "gcs",

    *gcs_bucket

    string Defines the GCS bucket name. "bucketname",

    *path

    string Path to folder where export file will be stored. "/folder"
    *selected_timeframe_start string Start time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    *selected_timeframe_end string End time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    selected_category string Optional. Specifies the category to export. Possible values: API, automated messages, batch messages, data automations, exports, imports, inbound, jobs, JS listener, system "API",
    selected_level string Optional. Specifies the level to export. Possible values: Debug, info, warning, error. If no value is passed, all levels will be exported. "Error",
    limitRecordsPerFile integer Optional. Defines the number of exported records per file. If no value is passed, all records that match the filters will be exported in one file. Default is 0. "1000",
    compress boolean Optional. Compresses the exported file. If value is "true", the file is compressed using GZIP with the file extension ".gz" added to the filename. "true",
    confirmEmail  email Optional. Email address to send an alert when the export job has been completed.  "msmith@example.com",
  • * Required

    Parameter Type Description Example
    *name string Defines the export file name. The name may only contain letters, numbers, and dashes. If provided, this value will be displayed next to the job ID on the Jobs Widget page. "accountmonitorexport",

    *destination

    object Defines the destination. See example below.
    *type string Defines the destination type. "azureblob",

    *path

    string Path to folder where the export file will be stored. "/folder", 

    *account 

    string Defines the Azure Blog account name. "demoaccount",

    *container

    string Defines the Azure Blog storage container name. "democontainer",
    *selected_timeframe_start string Start time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    *selected_timeframe_end string End time for the export time period. ISO08601 date format. "2024-07-18T18:51:31.422Z",
    selected_category string Optional. Specifies the category to export. Possible values: API, automated messages, batch messages, data automations, exports, imports, inbound, jobs, JS listener, system "API",
    selected_level string Optional. Specifies the level to export. Possible values: Debug, info, warning, error. If no value is passed, all levels will be exported. "Error",
    limitRecordsPerFile integer Optional. Defines the number of exported records per file. If no value is passed, all records that match the filters will be exported in one file. Default is 0. "1000",
    compress boolean Optional. Compresses the exported file. If value is "true", the file is compressed using GZIP with the file extension ".gz" added to the filename. "true",
    confirmEmail  email Optional. Email address to send an alert when the export job has been completed.  "msmith@example.com",

If no value is provided for selected_category, all categories will be returned. If no value is provided for selected_level, all levels will be returned.

Example JSON requests

The following JSON requests are listed according to destination requirements.

  • The following will initiate an export job of a JSON file containing all Account Monitor error logs, which will be downloadable via the UI on the Jobs page.

    {
        "name": "accountmonitorexport",
        "destination": {
            "type": "aws"
        },
        "selected_timeframe_start": "2024-07-18T18:51:31.422Z",
        "selected_timeframe_end": "2024-07-19T18:51:31.422Z",
        "selected_category": "batchmessages",
        "selected_level": "Error",
        "limitRecordsPerFile": 1000,
        "compress": true,
        "confirmEmail": "demo@example.com"
    }
  • The following will initiate an export job of all Account Monitor error logs from a one-day timespan into a JSON file(s) via Amazon S3, limiting the records per file to 1,000. In this example, the file will be uploaded to s3://my_bucket/folder.

    {
        "name": "accountmonitorexport",
        "destination": {
            "type": "aws",
            "aws_access_key_id": "0101010101",
            "aws_secret_access_key": "demostring",
            "aws_bucket": "my_bucket_folder",
            "aws_region": "us-west-2",
        },
        "selected_timeframe_start": "2024-07-18T18:51:31.422Z",
        "selected_timeframe_end": "2024-07-19T18:51:31.422Z",
        "selected_category": "API",
        "selected_level": "Error",
        "limitRecordsPerFile": 1000,
        "compress": true,
        "confirmEmail": "demo@example.com"
    }

    We recommend omitting the trailing slash right after your S3 path name to avoid duplicate slashes being added by default. For example, use folder instead of /folder/.

  • The following will initiate an export job of a JSON file via SFTP containing all error logs.

    {
        "name": "accountmonitorexport",
        "destination": {
            "type": "sftp",
            "server": "example.com",
            "port": "21",
            "username": "username",
            "password": "password",
            "path": "/"
        },
        "selected_timeframe_start": "2024-07-18T18:51:31.422Z",
        "selected_timeframe_end": "2024-07-19T18:51:31.422Z",
        "selected_category": "automatedmessages",
        "selected_level": "Error",
        "limitRecordsPerFile": 1000,
        "compress": true,
        "confirmEmail": "demo@example.com"
    }
  • The following will initiate an export job of all Account Monitor error logs in a JSON file via Google Cloud Storage (GCS).

    Your Google Could Storage integration must be enabled on the Integrations > Partners page.

    {
        "name": "accountmonitorexport",
        "destination": {
            "type": "gcs",
            "gcs_bucket": "bucketname",
            "path": "/accountmonitorexport"
        },
        "selected_timeframe_start": "2024-07-18T18:51:31.422Z",
        "selected_timeframe_end": "2024-07-19T18:51:31.422Z",
        "selected_category": "API",
        "selected_level": "Error",
        "limitRecordsPerFile": 1000,
        "compress": true,
        "confirmEmail": "demo@example.com"
    }
  • The following will initiate an export job of all Account Monitor error logs in a JSON file via Azure Blob.

    Your Azure Blob integration must be enabled on the Integrations > Partners page.

    {
        "name": "accountmonitorexport",
        "destination": {
            "type": "azureblob",
            "gcs_bucket": "bucketname",
            "path": "/accountmonitorexport"
            "account": "string",
            "container": "string"
        },
        "selected_timeframe_start": "2024-07-18T18:51:31.422Z",
        "selected_timeframe_end": "2024-07-19T18:51:31.422Z",
        "selected_category": "API",
        "selected_level": "Error",
        "limitRecordsPerFile": 1000,
        "compress": true,
        "confirmEmail": "demo@example.com"
    }

Example request URL

The following URL in conjunction with the JSON will perform the POST.

https://<path>/v2/accountmonitorexport

Example JSON response

Upon success, the export job ID will be returned.

{
    "jobId": "123examplejobId"
}

Test in Swagger

You can access and test Cordial's APIs in Swagger.

Error responses

The Cordial API will return an error object with an errorKey and message if there is a problem with an API call. You can find common errors on the Global API error responses page.

Comments

0 comments

Please sign in to leave a comment.