Введение
Наш API позволяет укорачивать ссылки непосредственно на вашем сайте. Когда вы регистрируетесь на hop.kz в вашем профиле генерируется уникальный ключ API, который вы можете использовать в запросах на вашем сайте ...
Приведенные ниже примеры генерируют ответ в json, но вы можете также использовать xml, заменив в конце гиперссылки json на xml.
Создание ссылки
Create a new short url providing a base64 encoded version of the original long url.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
url |
string |
Base64 encoded version of your long url. base64_encode() in PHP. |
Return Values:
Name: |
Type: |
Описание: |
url_id |
integer |
Unique url id. |
short_url |
string |
Short url including domain name. |
short_url_part |
string |
Short url part. (excluding domain name) |
original_url |
string |
The original decoded long url. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/create/url/BASE64_ENCODED_LONG_URL.json
Пример ответа:
{
"code":200,
"data":{
"url_id":"1388597",
"short_url":"http://hop.kz/srt",
"short_url_part":"srt",
"original_url":"http://www.bbc.co.uk",
"date_time":"2013-04-04 16:18:05"
}
}
Создание (Дополнительные возможности)
Create a new short url including some additional settings such as a custom short url, password to access and an expiry date.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
url |
string |
Base64 encoded version of your long url. base64_encode() in PHP. |
custom_url (optional) |
string |
Custom short url part. |
password (optional) |
string |
Password to access url. |
expiry_date (optional) |
string |
Date to expire the url. In the format yyyy-mm-dd. |
Return Values:
Name: |
Type: |
Описание: |
url_id |
integer |
Unique url id. |
short_url |
string |
Short url including domain name. |
short_url_part |
string |
Short url part. (excluding domain name) |
original_url |
string |
The original decoded long url. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/create/custom_url/CUSTOM_SHORT_URL/password/PASSWORD_TO_ACCESS/expiry_date/URL_EXPIRY_DATE/url/BASE64_ENCODED_LONG_URL.json
Пример ответа:
{
"code":200,
"data":{
"url_id":"1388598",
"short_url":"http://hop.kz/bbc",
"short_url_part":"bbc",
"original_url":"http://www.bbc.co.uk",
"date_time":"2013-04-04 16:18:08"
}
}
Disable
Disable an active short url within your account.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
short_url |
string |
Base64 encoded version of your short url. base64_encode() in PHP. |
Return Values:
Name: |
Type: |
Описание: |
url_id |
integer |
Unique url id. |
status |
string |
Статус короткой ссылки. |
short_url |
string |
Short url including domain name. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/disable/short_url/BASE64_ENCODED_SHORT_URL.json
Пример ответа:
{
"code":200,
"data":{
"url_id":"1388598",
"status":"disabled",
"short_url":"http://hop.kz/bbc",
"date_time":"2013-04-04 17:01:42"
}
}
Activate
Activate a disabled short url within your account.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
short_url |
string |
Base64 encoded version of your short url. base64_encode() in PHP. |
Return Values:
Name: |
Type: |
Описание: |
url_id |
integer |
Unique url id. |
status |
string |
Статус короткой ссылки. |
short_url |
string |
Short url including domain name. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/enable/short_url/BASE64_ENCODED_SHORT_URL.json
Пример ответа:
{
"code":200,
"data":{
"url_id":"1388598",
"status":"active",
"short_url":"http://hop.kz/bbc",
"date_time":"2013-04-04 17:01:42"
}
}
Info
Get detailed information for any short url within your account.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
short_url |
string |
Base64 encoded version of your short url. base64_encode() in PHP. |
Return Values:
Name: |
Type: |
Описание: |
url_id |
integer |
Unique url id. |
short_url |
string |
Short url including domain name. |
short_url_part |
string |
Short url part. (excluding domain name) |
original_url |
string |
The original decoded long url. |
date_created |
string |
Дата/время создания короткой ссылки. |
last_accessed |
string |
The date/time the short url was last accessed. |
total_visits |
integer |
Всего переходов |
has_password |
bool |
Whether the url needs a password to access. |
expiry_date |
string |
The date/time the short url will expire. |
status |
string |
Статус короткой ссылки. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/info/short_url/BASE64_ENCODED_SHORT_URL.json
Пример ответа:
{
"code":200,
"data":{
"url_id":"13423436",
"short_url":"http://hop.kz/bbc",
"short_url_part":"bbc",
"original_url":"http://www.bbc.co.uk",
"date_created":"2013-04-04 12:36:09",
"last_accessed":"2013-05-02 12:32:05",
"total_visits":"3452",
"has_password":true,
"expiry_date":"2019-03-02 23:59:59",
"status":"active",
"date_time":"2013-04-04 17:10:14"
}
}
List
List all active urls within your account.
Parameters:
Name: |
Type: |
Описание: |
key |
string |
Your API access key. Login to view. |
Return Values:
Name: |
Type: |
Описание: |
urls |
array |
List of short urls within the account. |
date_time |
string |
Дата и время вызова API. В формате yyyy-mm-dd hh:mm:ss. |
Пример запроса:
Адреса API: http://hop.kz
GET //api/v1/4651c908ef6c1f1810c63710c5b176b5/shorturl/list_active_urls.json
Пример ответа:
{
"code":200,
"data":{
"urls":[
{
"short_url":"http://hop.kz/2F"
},
{
"short_url":"http://hop.kz/2q"
}
],
"date_time":"2013-04-09 09:48:05"
}
}