bit.ly 域名缩短
来源:互联网 发布:sql server 2012激活码 编辑:程序博客网 时间:2024/04/30 17:48
首先到 bit.ly 官方网站(bit.ly)申请一个账号,然后获取API KEY。注册过后,通过该账号进行的域名缩短服务都会有记录,可以帮助用户进行分析等。
注册账号后,只要进入Setting,可以看到你的API key。
API 说明:
RESTAPI¶
/v3/shorten¶
For a long URL,/v3/shorten encodes a URL and returns a short one.
Parameters
- format (optional) indicates the requested response format. supported formats: json (default), xml, txt.
- longUrl is a long URL to be shortened (example: http://betaworks.com/).
- domain (optional) refers to a preferred domain; either bit.ly default or j.mp. This affects the output value of url.
- x_login (optional) is the end-user's login when make requests on behalf of another bit.ly user. This allows application developers to pass along an end user's bit.ly login.
- x_apiKey (optional) is the end-user's apiKey when making requests on behalf of another bit.ly user. This allows application developers to pass along an end user's bit.ly apiKey.
Notes
- Long URLs should be URL-encoded. You can not include a longUrl in the request that has '&', '?', '#', ' ', or other reserved parameters without first encoding it.
- Long URLs should not contain spaces: any longUrl with spaces will be rejected. All spaces should be either percent encoded (%20) or plus encoded (+). Note that tabs, newlines and trailing spaces are all indications of errors. Please remember to strip leading and trailing whitespace from any user input before shortening.
- Long URLs must have a slash between the domain and the path component. For example, http://example.com?query=parameter is invalid, and instead should be formatted as http://example.com/?query=parameter
- When including x_login and x_apiKey, the shortened URL will be inserted into the history for the user specified by x_login. it will not be inserted into the history for the user specified by login.
参考URL: http://code.google.com/p/bitly-api/wiki/ApiDocumentation#/v3/shorten
http://code.google.com/p/bitly-api/wiki/ApiBestPractices#Rate_Limiting
使用方法:
t通过HTTP请求的方式。
GET方式:
http://api.bit.ly/v3/shorten?login=XXX&apiKey=R_a2dc759....&longUrl=http%3A%2F%2Fwww.baidu.com%2F&format=xml
其中:
Login :表示用户名
Apikey:表示API key (注册账号后即分配)
longUrl:表示要被转换的长URL (注释格式必须正确)
format:表示指定返回值类型,bit.ly支持三种形式: json、xml、txt,默认为json。
还可以加其他的参数,具体参照上面的Parameters说明。
请求后返回结果:
上图中,url是缩短后的网址。
总结:
1.需要到bit.ly注册一个账号,需要用到 用户名、API key
2.注意选择返回值类型,json、xml、txt (系统默认json)
3.注意选择域名缩短的形式: bit.ly 、 m.jp
4.另外在进行域名缩短前,可能还得考虑bit.ly支持哪些国家等等信息。避免软件在其他国家使用时异常终止等事件的发生。
5.有访问频率限制。单个IP最多允许5个连接。访问频率每小时会刷新。
- bit.ly 域名缩短
- bit.ly思路
- ly
- 缩短网站域名的DNS解析时间
- Android使用bit.ly的api获取url 短连接
- 来自bit.ly的1.usa.gov数据
- Bit.ly取代TinyURL成为Twitter默认网址缩写服务
- 《利用Python进行数据分析》笔记---第2章--来自bit.ly的1.usa.gov数据
- LY RTOS for WinAVR
- MapXLib.Layer ly;
- ubuntu 编译 找不到 -ly
- 借我一生---LY
- ly博客简介
- 画图神器:plot.ly
- ly关注技术点2016
- musical.ly 实习小结一
- muscial.ly-实习小结2
- 第三方士大夫缩短额外地方缩短缩短世界杯意大利
- Linux下视频转换工具
- cnki账号 中国知网 免费 入口 用户名 密码 国内外学术刊物数据库账号
- 看了GAL游戏资源文件黑盒分析,想起以前做的一个提取器,发来大家共享一下
- 30岁前男人需要完成的事
- 写在2011之前
- bit.ly 域名缩短
- nfs共享模式搭建rac,监听配置
- JS对象转化成JSON字符串
- reporting services中主报表钻取子报表的在执行web请求时的问题
- Emacs用nxhtml来帮助写html - 笔记
- MS的程序员应该tjjtds,一个纯文档文件的内容竟然能当作头域解析。
- FS2410 开发板linux-2.6.35内核 LCD 驱动移植
- ASP.NET一些基础控件的实践
- JasperReports + iReport 4.0 开发制作日文报表项目