How to call the API

1. Conventions, restrictions and assumptions

JIRA has WeChat Work for Jira plug-in, and has completed the Mobile configuration, User Binding Configuration.

2. Interface document

(1) Function description

According to the parameters passed in by the caller, a message notification is sent to the corresponding enterprise wechat users.

(2) Call description

Request type

POST

Request address

{jira_base_url}/rest/weChat-jira/2/message/sendMessage

Media Type

application/json

Request Header

weChatNotiToken: xxxxxx

Required.

weChatNotiToken is a security token that other plug-ins or third-party services must provide when calling this API.Please refer to the following for details.

Auth

Anonymous interface does not require Auth.Judge whether the call is legal through weChatNotiToken passed from headers.

Body

Transfer body in JSON format.

 

{     

"userKey":["JIRAUSER10100", "JIRAUSER19625"],    

 "mode":"0",    

 "title":"XXX is due",     

"content":"XXX is due, please deal with it as soon as possible",    

 "url":"https://www.xxx.com "

}

 

Mandatory Field:

userKey、mode、title、content、url(Only card type is required)

Parameter description

  1. userKey: A collection, unique identity of JIRA users(Note: User Key is not User ID).

  2. mode: Ways of enterprise wechat message notification(Integer type:1 is text, 0 is card).

  3. title: Message title(String type; No more than 128 bytes, more than interception)。

  4. content: Message content(String type;HTML tags need stitching, no more than 512 bytes, more than interception)。

  5. url: Click the card message and jump to the URL of the details page(String type; Make sure the protocol header is included(http/https)).Non card message type value can be empty.

 

(3) Message Return

Example of message return format:

{"code": "00000", "msg": "sent successfully"}

 

The returned content is a string, the format is JSON, UTF-8 encoding. Including code and msg.

 

code is message code, msg is message content.

 

Please refer to the following for specific message return : 4. Message code and message content list.

 

3. Logging

Every request message received by the interface will be recorded in JIRA log, which is convenient for debugging and troubleshooting in the later stage.

All errors and exceptions are recorded in atlassian-jira.log (jira application log),catalina.out (jira tomcat log).

 

4. Message code and message content list

Message code

Message content(English)

00000

Sent successfully

90000

Illegal parameter construction

90001

Invalid license for WeChat Work for Jira plug-in

90002

weChatNotiToken is illegal

90003

The user does not exist or is not bound to the enterprise weChat user

90004

Illegal parameter mode

90005

Illegal parameter title

90006

The url can’t be empty when the sending format is card

90007

The configuration of plug-in WeChat Work for Jira is wrong

90008

This is no request header in Headers

90009

Illegal parameter content