API (java)

Last updated: 2020-11-13 18:53:31

    SDK Description

    This SDK is used to encapsulate the TPNS server APIs and communicate with the TPNS server. To use it, you only need to import the XingeApp package. This SDK mainly encapsulates push-related V3 APIs.

    Integration Methods

    Import Maven dependencies:

    <dependency>
                <groupId>com.github.xingePush</groupId>
                <artifactId>xinge</artifactId>
                <version>1.2.2</version>
    </dependency>

    Directions

    XingeApp API description

    This class provides APIs for interaction with the TPNS server, which is constructed by XingeApp.Builder with the following parameters:

    Parameter Name Type Required Default Value Description
    appId Integer Yes Empty Push target AccessID, which can be obtained in the Product Management page in the console
    secretKey String Yes Empty Push key
    proxy Proxy No Proxy.NO_PROXY This parameter can be set if a proxy needs to be configured
    connectTimeOut Integer No 10s Connection timeout period
    readTimeOut Integer No 10s Request timeout period
    domainUrl String No https://openapi.xg.qq.com/ API request service domain name address, which is the XG API address by default. Change the value to the service URL corresponding to your service access point

    Samples

    XingeApp xingeApp = new XingeApp.Builder()
            .appId(appid)
            .secretKey(secretKey)
            .domainUrl("https://api.tpns.tencent.com/")    
            .build();
    
    PushAppRequest pushAppRequest = new PushAppRequest();
    // Complete the `PushAppRequest` message
    ... 
    JSONObject ret =  xingeApp.pushApp(pushAppRequest );

    pushAppRequest API description

    This class provides an encapsulated push message body. For the description and usage of parameters, please see Push API Description.

    Server Return Codes

    For the meaning of ret_code, please see Server-Side Error Codes.

    FAQs

    1. What should I do if the error code 10101 or 403 is returned?
      Check whether the application AccessID matches with SecretKey, and whether domainUrl corresponds to the service access point of the application.

    2. What should I do if the error code 1008007 indicating parameter verification failure is returned?
      Refer to Push API and ensure that all the parameters are entered correctly.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help