Subscription Service Manual

catalog

Service Introduction

The microblog platform subscription service improves the efficiency of applications to obtain microblog data. According to the subscription conditions specified by the application, such as keywords, users, domain names, etc., the platform actively pushes the newly generated data to the application in real time, and the application does not need a polling request interface.


The advantages of subscription services are as follows:

1. Push new data to applications in real time;

2. Save network overhead;

3. Provide more and more comprehensive data;

4. Improve the efficiency of application access interface;


Subscription conditions

Subscribers:

Developers can specify up to 10000 users. When subscribing to microblog, microblog sent by the specified user will be pushed; When subscribing to comments, push the comments under the microblog published by the specified user (not the comments issued by the specified user).


Subscription keywords:

Developers can specify up to 20000 keywords. When subscribing to Weibo, if Weibo contains specified keywords, it will be pushed; When subscribing to a comment, the comment whose corresponding microblog (if it is a forwarded microblog, it does not match the content in the original microblog) contains this keyword, or the comment itself contains this keyword, will be pushed.

Note: When the content of the forwarded microblog does not contain this keyword, but the original microblog contains it, it is not pushed by default; If you need to match the content in the original microblog, you can apply for the corresponding configuration separately.


Subscription domain name:

Developers can specify up to 20 domain names. When subscribing to Weibo, if the original link corresponding to the short link in Weibo is under the specified domain name, it will be pushed; When subscribing to a comment, the comment that contains a short link in the microblog corresponding to the comment and whose original link is the specified domain name will be pushed; If not specified, there is no such limit.


Subscribe to apps:

The developer can specify that only the data generated by the application generating the subscription will be pushed. If not specified, the data generated by all applications will be pushed.


Subscription media type:

This condition can only be specified when subscribing to Weibo. The developer can specify the original, forwarding, video, music, or picture type. Then push the microblog of the specified type; If not specified, there is no such restriction; When subscribing to comments, there is no such filter condition.


Subscription data type:

Developers can specify push microblog or comment data; If not specified, it will push Weibo by default.


Subscription percentage:

Developers can specify the percentage of data that meets the above subscription conditions. If not specified, 1% of data that meets the conditions will be pushed.


Subscription time range:

The developer can specify the start time and end time of the push. The push service is ready at the specified start time, and the push is terminated at the end time. If not specified, the start time is equal to the subscription generation time by default and is pushed all the time. When the push service is ready, developers can call the interface to connect and receive data.

Procedure

The subscription service steps are as follows:

 subscription.png


① Generate subscription:

Developer fills in offline Subscription Service Application Form , fill in subscription conditions and other information, and platform personnel will generate subscriptions according to the application form information. Each application can have multiple subscriptions. Developers who need to try subscription services should submit their applications online (see the Access Guide for details) without filling in the application form.


② Set keywords and users for subscription:

Subscription Service Application Form This step is ignored when No is selected for Subscribe Keyword and Subscribe User in. If Yes is selected, the keyword subscription list and user subscription list must not be empty. Subscribe to keywords and users (if you have subscribed to keywords and users, you can ignore this step). Request interface: subscribe/update_subscribe


The requested IP address of the interface must be an IP address in the IP list specified during subscription. Otherwise, an error message will be returned: Ip is limited. When only the subid is transferred, the subscription information of the subscription is returned, including the subscribed keyword list and user list.


Each keyword is separated by a comma, and the relationship between comma separated keywords is a logical "or".

The length of each keyword cannot exceed 35 Chinese characters and 105 English letters.

Each keyword supports the logic of "AND" and "NOT" internally, and the logic of "AND" is separated by "space": for example, A B; Logical "non" is separated by "space -", such as A - B. When a keyword is surrounded by double quotation marks, it means that the keyword content is absolutely matched and the logical operation is invalid, such as "A B", which no longer means logical A and B.

The total number of keywords for each subscription should not exceed 20000, including no more than 1000 logical keywords.

The number of keywords subscribed to each interface call cannot exceed 50. The number of users who call the interface subscription each time cannot exceed 50. The total number of keywords and users in each subscription cannot exceed 20000, and repeated subscriptions are not allowed.

The Weibo platform will set some keywords and users to protection status, and protected keywords and users cannot be subscribed. After a keyword is protected, the words containing this keyword cannot be subscribed. Subscribed keywords and data filtered by keywords are not case sensitive, simple and traditional.


③ Push service ready:

If the developer has specified the start time of push in the application form, the push service for this subscription will be ready at the specified start time; If not specified, the push service after subscription generation is ready.


④ Application connection and push start:

If the subscription has been generated, but the push service is not ready, the push status in the developer subscription management background displays: In preparation; If the push service is ready, it displays Ready. Only when the application is ready can it call the interface to connect and receive data. Otherwise, an error is reported when calling the interface.

  • Subscribe to microblog and comment is an interface. The address is: commercial/push

Java call, see New version sample code


⑤ Application receiving data:

After successful connection, the interface will push microblog or comment data to the developer's connection address. Each complete microblog or comment data is returned in the form of json, which is encoded in UTF-8 by default and separated by r n.


Refer to: Example


⑥ Push termination:

If the developer does not specify the end time of the push, it will be pushed all the time; If the end time is specified, the push will be terminated at the specified push end time. This is equivalent to the expiration of this subscription and will not be restarted.


instructions

The application receives data through the HTTP long connection request interface/commercial/push. The parameter subid (subscription ID) needs to be passed in to tell the platform which subscription data to push. If the request is correct, return the corresponding Data Results If the request is abnormal, return the corresponding error message


When the application has illegal operations or other reasons, the platform will suspend the data push function of the subscription, that is, it will no longer push data. Until the problem is solved, the platform can restart the push function. The application needs an HTTP long connection to request the interface again.


In addition, the IP address of the application request interface must be an IP address in the IP list specified during subscription. Otherwise, an error message will be returned: Ip is limited.


For more information, please refer to the document commercial/push

Status description

In the developer management center, you can see various display statuses of services, as shown in the red box below:
 subscription_start.png

There are five service statuses: Being Prepared, Ready, Started, Paused, and Terminated.


1) Preparing:

The subscription has been generated but has not reached the start time of the push specified by the developer. It is in the preparation state (at this time, the developer cannot connect to receive data). If the developer does not specify the start time of the push, after the subscription is generated, it will enter the ready state without being prepared.


2) Ready:

The subscription is generated. The start time of the push is up, but the developer is not connected to receive data. It is in the ready state. Or subscription generation. If the developer does not specify the start time of the push, and the developer is not connected to receive data, the service is also ready.


3) Opened:

In the ready state, the developer connects to receive data, and the service enters the enabled state.


4) Paused:

When the platform suspends the push function of the subscription due to illegal operation of the application or other reasons, the service will be suspended.


5) Terminated:

If the developer does not specify the end time of the push, it will be pushed all the time; If the end time is specified, the push will be terminated at the specified push end time. This is equivalent to the expiration of this subscription and will not be restarted. At this time, the service is terminated;


Language: chinese  |  English
Document update time: September 28, 2020