/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Get number of peak connections

    Copy link

    Retrieves the number of devices that were concurrently connected to Sendbird server during the requested time period.


    HTTP request

    Copy link
    GET https://api-{application_id}.sendbird.com/v3/applications/peak_connections
    

    Parameters

    Copy link

    The following table lists the parameters of an HTTP request that this action supports.

    Parameters
    RequiredTypeDescription

    time_dimension

    string

    Specifies a time range. Acceptable values are daily and monthly. If set to daily, a requested time period can't be greater than 62 days. If set to monthly, a requested time period can't be greater than 12 months.

    start_year

    int

    Specifies the start year of a requested time period in YYYY format.

    start_month

    int

    Specifies the start month of a requested time period. Acceptable values are 1 to 12, inclusive.

    end_year

    int

    Specifies the end year of a requested time period in YYYY format.

    end_month

    int

    Specifies the end month of a requested time period. Acceptable values are 1 to 12, inclusive.

    OptionalTypeDescription

    start_day

    int

    Specifies the start day of a requested time period. Acceptable values are 1 to 31, inclusive. (Default:1)

    * This parameter can't be used when the value of time_dimension is set to monthly.

    end_day

    int

    Specifies the end day of a requested time period. Acceptable values are 1 to 31, inclusive. (Default: a value of the end_month property)

    * This parameter can't be used when the value of time_dimension is set to monthly.


    Response

    Copy link

    If successful, this action returns the number of peak connections during the requested time period in the response body.

    Daily peak connectionsMonthly peak connections
    {
        "peak_connections": [
            { "date": "2021-01-12", "peak_connections": 103 },
            { "date": "2021-01-13", "peak_connections": 104 },
            { "date": "2021-01-14", "peak_connections": 832 }
        ]
    }
    

    Error response

    Copy link

    This action returns an error in the following three cases:

    • The requested time period exceeds 62 days when a value of the time_dimension property is set to daily or 12 months when a value of the time_dimension property is set to monthly.

    • The specified value of start_month, end_month, start_day, or end_day isn't valid.

    • Either start_day or end_day is specified when time_dimension is set to monthly.

    // When the requested time range exceeds the acceptable range, this action returns an error.
    
    {
        "message": "Invalid value: Date range for daily time span can't be more than 62 days.",
        "code": 400111,
        "error": true
    }
    
    {
        "message": "Invalid value: Date range for monthly time span can't be more than 12 months.",
        "code": 400111,
        "error": true
    }
    
    // When the value of `start_month`, `end_month`, `start_day`, or `end_day` isn't valid, this action returns an error.
    
    {
        "message": "Invalid value: Acceptable values for month range from 1 to 12, inclusive.",
        "code": 400111,
        "error": true
    }
    
    {
        "message": "Invalid value: Acceptable values for day range from 1 to 31, inclusive.",
        "code": 400111,
        "error": true
    }
    
    // If either `start_day` or `end_day` is specified when `time_dimension` is **monthly**, this action returns an error.
    
    {
        "message": "Invalid value: \"start_day\" can only be used when \"time_dimension\" is \"daily\".",
        "code": 400111,
        "error": true
    }
    
    {
        "message": "Invalid value: \"end_day\" can only be used when \"time_dimension\" is \"daily\".",
        "code": 400111,
        "error": true
    }
    

    In the case of an error, an error object is returned. A detailed list of error codes is available here.