Application Management API

Last updated:2022-07-22
Expand all
Application Management API

The JPush Admin API provides developers with features such as creating/deleting apps and uploading certificates. The unified API address is: https://admin.jpush.cn/v1/

Note: The Admin API is not fully open yet. To try this feature, please contact us.

Request header definition:

  • Value of HTTP Header Authorization: Basic base64_auth_string;
  • The generation rule for base64_auth_string is: base64(dev_key:dev_secret). Obtain dev_key and dev_secret from the developer account page after logging in to the official website;
  • Note that dev_key and dev_secret are separated by a colon ":".

See the relevant specification document: HTTP Basic Authentication.

Create a Jiguang App

Function Description

Create an app under the developer account.

Request URL

POST https://admin.jpush.cn/v1/app

Request Example

curl -X POST -v https://admin.jpush.cn/v1/app -H 'Content-type: application/json' -u 'd61988533983cbc7a2eceb0a:fb3ea2a1830d9731ef202a8f' -d '{"app_name":"myapp","android_package":"cn.jpush.app","group_name":"groupOne"}' > POST /v1/app HTTP/1.1 > Authorization: Basic ZDYxOTg4NTMzOTgzY2JjN2EyZWNlYjBhOmZiM2VhMmExODMwZDk3MzFlZjIwMmE4Zg==
              curl -X POST -v https://admin.jpush.cn/v1/app
         -H 'Content-type: application/json'
         -u 'd61988533983cbc7a2eceb0a:fb3ea2a1830d9731ef202a8f'
         -d '{"app_name":"myapp","android_package":"cn.jpush.app","group_name":"groupOne"}'

    > POST /v1/app HTTP/1.1
    > Authorization: Basic ZDYxOTg4NTMzOTgzY2JjN2EyZWNlYjBhOmZiM2VhMmExODMwZDk3MzFlZjIwMmE4Zg==

        
This code block is shown in the floating window

Request Parameters

The request parameter is an App object expressed in JSON format. The included fields are as follows:

Parameter Name Type Required Description
app_name string Yes Application name
android_package string Yes Application package name (Android)
group_name string No Application group name
{"app_name":"myapp","android_package":"cn.jpush.app","group_name":"groupOne"}
              {"app_name":"myapp","android_package":"cn.jpush.app","group_name":"groupOne"}

        
This code block is shown in the floating window

Response Example

< HTTP/1.1 200 OK < Content-Type: application/json {"app_key":"dc51b6829206b2736e7e6d63","is_new_created":true,"android_package":"cn.jpush.app"}
              < HTTP/1.1 200 OK
    < Content-Type: application/json
    {"app_key":"dc51b6829206b2736e7e6d63","is_new_created":true,"android_package":"cn.jpush.app"}

        
This code block is shown in the floating window

Response Parameters

Parameter Name Type Description
app_key string Application identifier
android_package string Application package name (Android)
is_new_created boolean
master_secret string Used together with AppKey for authentication when calling server-side APIs.

Delete an App

Function Description

Delete a specified app under the developer account.

Request URL

POST https://admin.jpush.cn/v1/app/{appKey}/delete

Request Example

curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/delete -X POST -u devKey:devSecret
           curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/delete
 -X POST
 -u devKey:devSecret

        
This code block is shown in the floating window

Response Example

Error: {"error":{"code":1015,"message":"app delete fail"}} Success: {"success":"Synchronized success"}
           Error: {"error":{"code":1015,"message":"app delete fail"}}
 Success: {"success":"Synchronized success"}

        
This code block is shown in the floating window

Upload Certificate

Function Description

Developers can use this API to upload certificates to the corresponding Jiguang app.

Request URL

POST https://admin.jpush.cn/v1/app/{appKey}/certificate

Request Example

curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/certificate -F "devCertificatePassword=your dev certificate passowrd" -F "proCertificatePassword=your pro certificate passowrd" -F "devCertificateFile=@your dev certificate file" -F "proCertificateFile=@your pro certificate file" -u '{devKey}:{devSecret}'
           curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/certificate
 -F "devCertificatePassword=your dev certificate passowrd"
 -F "proCertificatePassword=your pro certificate passowrd"
 -F "devCertificateFile=@your dev certificate file"
 -F "proCertificateFile=@your pro certificate file"
 -u '{devKey}:{devSecret}'

        
This code block is shown in the floating window

If there is no dev certificate or pro certificate, the corresponding -F parameters and password are not required. The following is an example request with only a dev certificate:

curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/certificate -F "devCertificatePassword=your dev certificate passowrd" -F "devCertificateFile=@your dev certificate file" -u 'devKey:devSecret'
           curl https://admin.jpush.cn/v1/app/ffbb0932c267d938941e470b/certificate
 -F "devCertificatePassword=your dev certificate passowrd"
 -F "devCertificateFile=@your dev certificate file"
 -u 'devKey:devSecret'

        
This code block is shown in the floating window

Request Parameters

Parameter Name Type Description
devCertificatePassword string dev certificate password
proCertificatePassword string pro certificate password
devCertificateFile file dev certificate file
proCertificateFile file pro certificate file

Response Example

Error: {"error":{"code":1012,"message":"certificate invalid"}} Success: {"success":"Synchronized success"}
           Error: {"error":{"code":1012,"message":"certificate invalid"}}
 Success: {"success":"Synchronized success"}

        
This code block is shown in the floating window

Response Parameters

Parameter Name Type Description
code int Return code
message string Response message

Error Codes

HTTP Status Code Error Code Description
200 - Success!
200 1010 Certificate already exists
200 1012 Invalid certificate
200 1013 Invalid appkey
200 1014 No certificate file in parameters
200 1015 App deletion failed
405 4001 Only the HTTP POST method is supported
400 4002 Request parameters are empty
400 4003 Invalid request parameters
401 4004 Permission verification error: dev_key does not exist
401 4005 Permission verification error: dev_secret is incorrect
401 4007 Permission not enabled
500 10 System error

Reference document: HTTP-Status-Code

Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center