POOL provides a system that is versatile for customizing media filenames. This API endpoint will return both the available filenaming options in addition to selections that the user has currently selected. The index numbers for each option will be referenced for Saving Filenaming Options.
Example JSON Output
{
"file_name_01":
{
"0": null,
"1": "Title",
"2": "Artist",
"3": "Mix",
"4": "Duration",
"5": "BPM",
"6": "End",
"7": "Genre",
"8": "Label",
"9": "Release",
"10": "Order",
"11": "Date Sent",
"12": "Impact Date",
"13": "Content Warn",
"14": "Format",
"selected": 2
},
"file_name_01_modifier":
{
"0": null,
"1": "-",
"2": "_",
"3": "( )",
"4": "( ) - ",
"selected": 1
},
"file_name_02":
{
"0": null,
"1": "Title",
"2": "Artist",
"3": "Mix",
"4": "Duration",
"5": "BPM",
"6": "End",
"7": "Genre",
"8": "Label",
"9": "Release",
"10": "Order",
"11": "Date Sent",
"12": "Impact Date",
"13": "Content Warn",
"14": "Format",
"selected": 1
},
"file_name_02_modifier":
{
"0": null,
"1": "-",
"2": "_",
"3": "( )",
"4": "( ) - ",
"selected": 0
},
"file_name_03":
{
"0": null,
"1": "Title",
"2": "Artist",
"3": "Mix",
"4": "Duration",
"5": "BPM",
"6": "End",
"7": "Genre",
"8": "Label",
"9": "Release",
"10": "Order",
"11": "Date Sent",
"12": "Impact Date",
"13": "Content Warn",
"14": "Format",
"selected": 3
},
"file_name_03_modifier":
{
"0": null,
"1": "-",
"2": "_",
"3": "( )",
"4": "( ) - ",
"selected": 3
},
"file_name_04":
{
"0": null,
"1": "Title",
"2": "Artist",
"3": "Mix",
"4": "Duration",
"5": "BPM",
"6": "End",
"7": "Genre",
"8": "Label",
"9": "Release",
"10": "Order",
"11": "Date Sent",
"12": "Impact Date",
"13": "Content Warn",
"14": "Format",
"selected": 0
},
"file_name_04_modifier":
{
"0": null,
"1": "-",
"2": "_",
"3": "( )",
"4": "( ) - ",
"selected": 0
},
"file_name_05":
{
"0": null,
"1": "Title",
"2": "Artist",
"3": "Mix",
"4": "Duration",
"5": "BPM",
"6": "End",
"7": "Genre",
"8": "Label",
"9": "Release",
"10": "Order",
"11": "Date Sent",
"12": "Impact Date",
"13": "Content Warn",
"14": "Format",
"selected": 0
},
"file_name_05_modifier":
{
"0": null,
"1": "( )",
"selected": 0
},
"file_name_caps": 0,
"file_name_spaces": 1
}
PHP (using cURL):
<?php
$userid = 1;
$token = "8b26e1e4f3f5e00a888807e605565c47";
$filenaming_url = "https://api.promoonly.com/user/filenaming";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $filenaming_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer ".base64_encode($userid.":".$token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$filenaming_result = curl_exec($ch);
curl_close($ch);
$filenaming_obj = json_decode($filenaming_result);
?>
Javascript (using jQuery):
function b64EncodeUnicode(str)
{
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1)
{
return String.fromCharCode('0x' + p1);
}));
}
var userid = 1;
var token = "8b26e1e4f3f5e00a888807e605565c47";
var auth_str = "Bearer " + b64EncodeUnicode(userid + ":" + token);
$.ajax({
type: "GET",
url: "https://api.promoonly.com/user/filenaming",
headers: { "Authorization": auth_str },
dataType: "json",
success: function (data)
{
console.log(data);
}
});
Python (using requests):
#!/usr/bin/env python
import requests
import base64
import urllib
userid = 1
token = "8b26e1e4f3f5e00a888807e605565c47"
b64_key = base64.b64encode("%s:%s" % (userid, token))
headers = {"Authorization": "Bearer %s" % b64_key}
filenaming_url = "https://api.promoonly.com/user/filenaming"
result_return = requests.get(filenaming_url, headers=headers)
print(result_return.text)