Streams Results

Get the stream monitoring results

GET https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/results

Path Parameters

NameTypeDescription

pid

number

The project id

stream_id

string

ID of the cake to get, for free of course.

Query Parameters

NameTypeDescription

type

string

last: get the last results day: get the day results Default is day

date

string

Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)

min_duration

number

Only return the results of played_duration greater than or equal to min_duration seconds (default: 0)

max_duration

number

Only return the results of played_duration less than or equal to max_duration seconds (default: 3600)

isrc_country

string

Only return results that match the isrc country code (E.g. DE, FR, IT, US)

with_false_positive

number

0: does not return results marked as false positive. (Default)

1: returns results marked false positive.

Headers

NameTypeDescription

Authorization

string

Bearer token

Accept

string

application/json

{
    "data": [
        {
            "status": {
                "msg": "Success",
                "code": 0,
                "version": "1.0"
            },
            "result_type": 0,
            "metadata": {
                "type": "delay",
                "timestamp_utc": "2021-01-07 10:18:45",
                "played_duration": 232,
                "music": [
                    {
                        "album": {
                            "name": "Angkara"
                        },
                        "play_offset_ms": 4780,
                        "sample_begin_time_offset_ms": 4940,
                        "title": "Angkara",
                        "result_from": 3,
                        "release_date": "2020-07-18",
                        "sample_end_time_offset_ms": 9580,
                        "label": "SEVENTEEN ELEVEN MUSIC SDN BHD",
                        "duration_ms": 240780,
                        "score": 100,
                        "db_begin_time_offset_ms": 0,
                        "artists": [
                            {
                                "name": "Siti Nordiana"
                            }
                        ],
                        "db_end_time_offset_ms": 4640,
                        "external_ids": {},
                        "acrid": "65e0152da24e3a79935c296ca1c541bf",
                        "external_metadata": {}
                    }
                ]
            }
        }
    ]
}
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/results?type=day&date=20210201' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'

The following is a sample script that displays the results in real-time

<?php

$project_id = "{project_id}";
$stream_id = "{stream_id}";
$token = "{bearer token}"; // https://docs.acrcloud.com/reference/console-api/accesstoken

$opts = [
    "http" => [
        "method" => "GET",
        "header" => "Accept: application/json\r\n" .
            "Authorization: Bearer " . $token . "\r\n"
    ]
];
$context = stream_context_create($opts);

$data = file_get_contents("https://api-v2.acrcloud.com/api/bm-cs-projects/" . $project_id . "/streams/" . $stream_id . "/results?type=last", false, $context);

$obj = json_decode($data, true);
# var_dump($obj);
$title = "";
$artists = "";
if (isset($obj['data']) && count($obj['data']) > 0) {
    $metadata = $obj['data'][0]['metadata'];
    if (array_key_exists('music', $metadata)) {
        $music = $metadata['music'][0];
        $title = $music['title'];
        $arlist = [];
        if (array_key_exists('artists', $music)) {
            foreach($music['artists'] as $ar) {
                $arlist[] = $ar['name'];
            }
        }
        if (count($arlist) > 0) {
            $artists = implode(', ', $arlist);
        }
    }
} 
$ret = ['title'=>$title, 'artists'=>$artists, 'result'=>$obj];
print_r(json_encode($ret));
?>

Getting results not recognized but detected as music. (Note: This API is only available for streams with music detection enabled)

GET https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/unknown_results

Path Parameters

NameTypeDescription

pid*

number

The project id

stream_id*

string

stream_id

Query Parameters

NameTypeDescription

date*

string

Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)

min_duration

number

Only return the results of played_duration greater than or equal to min_duration seconds (default: 0)

max_duration

number

Only return the results of played_duration less than or equal to max_duration seconds (default: 3600)

Headers

NameTypeDescription

Authorization*

string

Bearer token

Accept

string

application/json

{
    "data": [
        {
            "start_timestamp_utc": "2023-10-18 00:11:02",
            "end_timestamp_utc": "2023-10-18 00:12:05",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:20:06",
            "end_timestamp_utc": "2023-10-18 00:21:24",
            "played_duration": 78,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:36:12",
            "end_timestamp_utc": "2023-10-18 00:37:13",
            "played_duration": 61,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:58:54",
            "end_timestamp_utc": "2023-10-18 00:59:57",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 01:04:28",
            "end_timestamp_utc": "2023-10-18 01:05:35",
            "played_duration": 67,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 02:38:06",
            "end_timestamp_utc": "2023-10-18 02:39:16",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 03:20:48",
            "end_timestamp_utc": "2023-10-18 03:22:04",
            "played_duration": 76,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 05:29:10",
            "end_timestamp_utc": "2023-10-18 05:30:18",
            "played_duration": 68,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 07:21:34",
            "end_timestamp_utc": "2023-10-18 07:22:51",
            "played_duration": 77,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:18:52",
            "end_timestamp_utc": "2023-10-18 08:20:08",
            "played_duration": 76,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:41:13",
            "end_timestamp_utc": "2023-10-18 08:42:20",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:42:30",
            "end_timestamp_utc": "2023-10-18 08:43:37",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 09:24:51",
            "end_timestamp_utc": "2023-10-18 09:26:01",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 09:43:02",
            "end_timestamp_utc": "2023-10-18 09:44:06",
            "played_duration": 64,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 11:24:38",
            "end_timestamp_utc": "2023-10-18 11:25:48",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:03:12",
            "end_timestamp_utc": "2023-10-18 12:04:15",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:14:14",
            "end_timestamp_utc": "2023-10-18 12:15:17",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:19:33",
            "end_timestamp_utc": "2023-10-18 12:20:47",
            "played_duration": 74,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:28:30",
            "end_timestamp_utc": "2023-10-18 12:29:50",
            "played_duration": 80,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:53:57",
            "end_timestamp_utc": "2023-10-18 12:55:15",
            "played_duration": 78,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 14:01:51",
            "end_timestamp_utc": "2023-10-18 14:02:54",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 14:58:57",
            "end_timestamp_utc": "2023-10-18 14:59:59",
            "played_duration": 62,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 15:38:38",
            "end_timestamp_utc": "2023-10-18 15:39:43",
            "played_duration": 65,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 17:01:36",
            "end_timestamp_utc": "2023-10-18 17:02:39",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 17:23:08",
            "end_timestamp_utc": "2023-10-18 17:24:08",
            "played_duration": 60,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 18:01:47",
            "end_timestamp_utc": "2023-10-18 18:02:50",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 18:55:37",
            "end_timestamp_utc": "2023-10-18 18:56:44",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 21:41:16",
            "end_timestamp_utc": "2023-10-18 21:42:26",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 22:02:03",
            "end_timestamp_utc": "2023-10-18 22:03:13",
            "played_duration": 70,
            "name": "Background music"
        }
    ]
}

curl --location 'https://api-v2.acrcloud.com/api/bm-cs-projects/1234/streams/s-xxxxx/unknown_results?date=20231018&min_duration=60&max_duration=80' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'

Last updated