VK Audio API reference for VK Audio Token
Index
API Methods
General info
New API Methods

audio.getCatalog

Get current user sections or search for artists.

Parameters:

NameValue
artist_id (optional)Artist id
query (optional)Audio name or performer to search for
context (optional)Id of the context
count (optional)Number of sections to return
start_from (optional)Id of the offset

Context ids are returned in the context field. Offset is returned in the next_from field.

If neither artist_id nor query are specified, sections for the current user are returned.

Example — search for audios by an artist (VK Official):

$query = "Justin Bieber - Baby";
curl_setopt(
$ch, CURLOPT_URL, "https://api.vk.com/method/audio.getCatalog"
);
curl_setopt($ch,
CURLOPT_POSTFIELDS,
"v=5.116&https=1&lang=en&query=".urlencode($query)."&access_token=".TOKEN
);
<?php
include __DIR__.'/../../autoloader.php';
use Vodka2\VKAudioToken\SupportedClients;
//Credentials obtained by example_vkofficial.php script
define('TOKEN', $argv[1]);
define('USER_AGENT', SupportedClients::VkOfficial()->getUserAgent());
$ch = curl_init();
curl_setopt($ch,CURLOPT_HTTPHEADER, array('User-Agent: '.USER_AGENT));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$query = "Justin Bieber - Baby";
curl_setopt(
$ch, CURLOPT_URL, "https://api.vk.com/method/audio.getCatalog"
);
curl_setopt($ch,
CURLOPT_POSTFIELDS,
"v=5.116&https=1&lang=en&query=".urlencode($query)."&access_token=".TOKEN
);
echo json_encode(json_decode(curl_exec($ch)), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)."\n\n";