Sina short URL generated online, the official api interface to obtain program

Recently, Sina Weibo Technology Center to ban the most living on the outside before several key used to generate the short URL: app_key, resulting in a third party generates a short link service is almost paralyzed,


Sina interface documentation Address: http://open.weibo.com/wiki/Short_url/shorten


As can be seen from the document, Sina provided xml json formats and for generating a short connection, using the parameters OAuth authorization mode is required, after OAuth authorization is obtained.


The reason Sina is doing so in order to complete a short link to peel off from the microblogging platform, specially set up for this purpose t.cn short chain generation platform, free for everyone to generate short chain.


Affinity measurements can be reliably generated sina-t.cn

short_url/shorten

Converting one or more long links into short links


URL

https://api.weibo.com/2/short_url/shorten.json


Supported formats

JSON


HTTP request method

GET


Need to log

no

About login authorization, see how login authorization


Access authorization restrictions

Access level: a common interface

Frequency limit: Yes

About frequency restrictions, see the Interface Access Description

  required Type and scope Explanation
access_token true string Authorization using OAuth parameter is required, the OAuth authorization is obtained.
url_long true string We need to convert a long link, need U

Precautions

Url plurality of parameters required in the following manner: url_long = aaa & url_long = bbb


Sample call and debugging tools

API testing tool


Back to Results

JSON example


azx06uhx.png


{

    "urls": [

        {

            "url_short": "http://t.cn/h4DwT1",

            "url_long": "http://finance.sina.com.cn/",

            "type": 0,

            "result": "true"

        },

        {

            "url_short": "",

            "url_long": "http://finance.sina.com.cn/",

            "type": 0,

            "result": "false"

        },

        ...

    ]

}

 


About error return values ​​and error codes, see Error Code Description


Return Field Description

Return Value Field Type Field Description

url_short string short link

url_long string original long link

Type of type int link, 0: Normal Page, and 1: Video 2: Music, 3: Active, 5 vote

Available state result boolean short chain, true: Available, false: not available.



Guess you like

Origin blog.51cto.com/14545590/2438131