브랜딩 회원님 api가이드
05.Apr.2021API 가이드문서
참고하시기 바랍니다.
Parameter | Description |
---|---|
url | (required) Long URL to shorten. |
custom | (optional) Custom alias instead of random alias. |
type | (optional) Redirection type [direct, frame, splash] |
password | (optional) Password protection |
domain | (optional) Custom Domain |
expiry | (optional) Expiration for the link example 2021-04-05 01:00:27 |
geotarget | (optional) Geotargetting data |
devicetarget | (optional) Device Targetting data |
1. CURL
curl --location --request POST 'https://yourwebsite.com/api/url/add' \
--header 'Authorization: Token YOURAPIKEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://google.com",
"custom": "google",
"password": "mypass",
"domain": "http://goo.gl",
"expiry": "2020-11-11 12:00:00",
"type": "splash",
"geotarget": [{
"location": "Canada",
"link": "https://google.ca"
},
{
"location": "United States",
"link": "https://google.us"
}
],
"devicetarget": [{
"device": "iPhone",
"link": "https://google.com"
},
{
"device": "Android",
"link": "https://google.com"
}
]
}'
2. PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://yourwebsite.com/api/url/add",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 2,
CURLOPT_TIMEOUT => 10,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"Authorization: Token YOURAPIKEY",
"Content-Type: application/json",
),
CURLOPT_POSTFIELDS => '{
"url": "https://google.com",
"custom": "google",
"password": "mypass",
"domain": "http://goo.gl",
"expiry": "2020-11-11 12:00:00",
"type": "splash",
"geotarget": [{
"location": "Canada",
"link": "https://google.ca"
},
{
"location": "United States",
"link": "https://google.us"
}
],
"devicetarget": [{
"device": "iPhone",
"link": "https://google.com"
},
{
"device": "Android",
"link": "https://google.com"
}
]
}',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
3. Node.js
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://yourwebsite.com/api/url/add',
'headers': {
'Authorization': 'Token YOURAPIKEY',
'Content-Type': 'application/json',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});