All docs This doc
Skip to end of metadata
Go to start of metadata


Overview

The following operations allow you to work with issues. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with issues, see Sample configuration.

OperationDescription

createIssue

Creates an issue.

createIssueCommentCreates a comment for an issue.
editIssueEdits an issue.
getIssueRetrieves an issue.
listIssueCommentsLists comments on an issue.
listRepositoryIssuesLists issues.

Operation details

This section provides details on each of the operations.

 Creating an issue

The createIssue operation allows any user with pull access to the repository to create an issue.

createIssue
<github.createIssue>
	<milestone>{$ctx:milestone}</milestone>
    <issueContent>{$ctx:issueContent}</issueContent>
    <title>{$ctx:title}</title>
    <repo>{$ctx:repo}</repo>
    <labels>{$ctx:labels}</labels>
    <owner>{$ctx:owner}</owner>
    <assignee>{$ctx:assignee}</assignee>
</github.createIssue>
Properties
  • milestone: Milestone to associate this issue with. Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.
  • issueContent: The body or the content of the issue.
  • title: Required - The title of the issue.
  • repo: Required - The name of the repository.
  • labels: Labels to associate with this issue. Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
  • owner: Required - The owner of the repository.
  • assignee: Login for the user that this issue should be assigned to. Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise.
Sample request

Following is a sample REST request that can be handled by the createIssue operation.

Sample Request for createIssue
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f7ds32c08905e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/json",
	"owner":"User",
	"repo":"Test",
	"title":"Description",
	"assignee":"wso2connector",
	"milestone":3,
	"labels":["Label1","Label2"],
	"issueContent":"BBBBB"
} 
Related Github documentation

https://developer.github.com/v3/issues/#create-an-issue

 Creating a comment for an issue

The createIssueComment operation creates comments for issues.

createIssueComment
<github.createIssueComment>
	<owner>{$ctx:owner}</owner>
	<repo>{$ctx:repo}</repo>
	<number>{$ctx:number}</number>
	<issueCommentBody>{$ctx:issueCommentBody}</issueCommentBody>
</github.createIssueComment>
Properties
  • owner: Required - The owner of the repository.
  • repo: Required - The name of the repository.
  • number: Required - The issue number of the given repository.
  • issueCommentBody: Required - The contents of the comment.
Sample request

Following is a sample REST request that can be handled by the createIssueComment operation.

Sample Request for createIssueComment
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f732c08sd905e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/vnd.github.v3.full+json",
	"owner":"User",
	"repo":"Test",
	"number":"30",
	"issueCommentBody":"issueCommentBody"
}
Related Github documentation

https://developer.github.com/v3/issues/comments/#create-a-comment

 Editing an issue

The editIssue operation allows issue owners and users with push access to edit an issue.

editIssue
<github.editIssue>
	<milestone>{$ctx:milestone}</milestone>
    <issueCommentBody>{$ctx:issueCommentBody}</issueCommentBody>
    <title>{$ctx:title}</title>
    <repo>{$ctx:repo}</repo>
    <labels>{$ctx:labels}</labels>
    <state>{$ctx:state}</state>
    <owner>{$ctx:owner}</owner>
    <assignee>{$ctx:assignee}</assignee>
    <number>{$ctx:number}</number>
</github.editIssue>
Properties
  • milestone: Milestone to associate this issue with. Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise.
  • issueCommentBody: The contents of the issue. 
  • title: The title of the issue.
  • repo: Required - The repository containing the issue.
  • labels: Labels to associate with this issue. Specify one or more labels to replace the set of labels on this issue. Send an empty array ([]) to clear all labels from the issue. Only users with push access can set labels for issues. Labels are silently dropped otherwise.
  • state: Refers to the state of the issue, either open or closed.
  • owner: Required - The owner of the repository having the specified issue.
  • assignee: Login name of the user that this issue should be assigned to.
  • number: Required - The number of the issue.
Sample request

Following is a sample REST request that can be handled by the editIssue operation.

Sample Request for editIssue
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f732c089fd05e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/json",
	"owner":"User",
	"repo":"APITestRepo",
	"number":"116",
	"title": "Issue will be edited.",
	"issueCommentBody": "This is how I want to edit the issue.",
	"assignee":"User",
	"state": "open",
	"milestone":1,
	"labels": [
    	"Label1",
    	"Label2"
  			  ]
}
Related Github documentation

https://developer.github.com/v3/issues/#edit-an-issue

 Retrieving a single issue

The getIssue operation retrieves a single issue.

getIssue
<github.getIssue>
	<owner>{$ctx:owner}</owner>
	<repo>{$ctx:repo}</repo>
	<number>{$ctx:number}</number>
</github.getIssue>
Properties
  • owner: Required - The owner of the repository having the specified issue.
  • repo: Required - The repository containing the issue.
  • number: Required - The number of the issue.
Sample request

Following is a sample REST request that can be handled by the getIssue operation.

Sample Request for getIssue
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f732c089sd05e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/vnd.github.v3.full+json",
	"owner":"User",
	"repo":"Test",
	"number":"30"
}
Related Github documentation

https://developer.github.com/v3/issues/#get-a-single-issue

 Listing comments

The listIssueComments operation lists comments on an issue.

listIssueComments
<github.listIssueComments>
	<owner>{$ctx:owner}</owner>
    <repo>{$ctx:repo}</repo>
    <number>{$ctx:number}</number>
	<page>{$ctx:page}</page>
    <perPage>{$ctx:perPage}</perPage>
</github.listIssueComments>
Properties
  • owner: Required - The owner of the repository.
  • repo: Required - The name of the repository.
  • number: Required - The number of the issue.
  • page : Page number

  • perPage : Items per page

Sample request

Following is a sample REST request that can be handled by the listIssueComments operation.

Sample Request for listIssueComments
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f732c08df905e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/vnd.github+json",
	"owner":"User",
	"repo":"Test",
	"number":"44",
	"perPage" : 200
}
Related Github documentation

https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue

 Listing issues

The listRepositoryIssues operation lists issues for a repository.

listRepositoryIssues
<github.listRepositoryIssues>
	<owner>{$ctx:owner}</owner>
	<repo>{$ctx:repo}</repo>		 
    <milestone>{$ctx:milestone}</milestone>
	<state>{$ctx:state}</state>
	<assignee>{$ctx:assignee}</assignee>
	<creator>{$ctx:creator}</creator>
	<mentioned>{$ctx:mentioned}</mentioned>
	<labels>{$ctx:labels}</labels>		 
    <sort>{$ctx:sort}</sort>
    <direction>{$ctx:direction}</direction>
    <since>{$ctx:since}</since>
	<page>{$ctx:page}</page>
    <perPage>{$ctx:perPage}</perPage>
</github.listRepositoryIssues>
Properties
  • owner: Required - The name of the owner of the repository.
  • repo: Required - The name of the repository.
  • milestone: The milestone number. If an integer is passed, it should refer to a milestone number. If the string * is passed, issues with any milestone are accepted. If the string none is passed, issues without milestones are returned. Default: *
  • state: The state of the issues to return. Can be open, closed, or all. Default: open
  • assignee: The user whose issues you want to list. Set to none to list issues with no assigned user, and * for issues assigned to any user. Default: *
  • creator: The user that created the issue.
  • mentioned: A user mentioned in the issue.
  • labels: A comma-separated list of label names. Example: bug,ui,@high
  • sort: The field to use for sorting the results. Can be createdupdated, or comments. Default: created
  • direction: The direction of the sort. Can be either asc or desc. Default: desc
  • since: Only issues updated at or after this time are returned. This is a timestamp in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
  • page : Page number

  • perPage : Items per page

Sample request

Following is a sample REST request that can be handled by the listRepositoryIssues operation.

Sample Request for listRepositoryIssues
{
	"apiUrl":"https://api.github.com",
	"accessToken":"ed25f732cdf08905e6638ff0abd77f2ae6f4316701",
	"mediaType":"application/vnd.github+json",
	"owner":"user",
	"repo":"Test",
	"milestone":"*",
	"state":"open",
	"assignee":"UserOne",
	"creator":"UserTwo",
	"mentioned":"",
	"labels":"",
	"sort":"created",
	"direction":"asc",
	"since":"2010-05-09T17:38:36+05:30",
	 "perPage" : 200
}
Related Github documentation

https://developer.github.com/v3/issues/#list-issues-for-a-repository

Sample configuration

Following is a sample proxy service that illustrates how to connect to Github with the init operation and use the createIssue operation. The sample request for this proxy can be found in createIssue sample request. You can use this sample as a template for using other operations in this category.

As a best practice, create a separate sequence for handling the response payload for errors. In the following sample, this sequence is "faultHandlerSeq". For more information, see Configuring the Github Fault Handler Sequence.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="github_createIssue"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="mediaType" expression="json-eval($.mediaType)"/>
         <property name="owner" expression="json-eval($.owner)"/>
         <property name="repo" expression="json-eval($.repo)"/>
         <property name="title" expression="json-eval($.title)"/>
         <property name="issueContent" expression="json-eval($.issueContent)"/>
         <property name="assignee" expression="json-eval($.assignee)"/>
         <property name="milestone" expression="json-eval($.milestone)"/>
         <property name="labels" expression="json-eval($.labels)"/>
         <github.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
            <mediaType>{$ctx:mediaType}</mediaType>
         </github.init>
         <github.createIssue>
            <milestone>{$ctx:milestone}</milestone>
            <issueContent>{$ctx:issueContent}</issueContent>
            <title>{$ctx:title}</title>
            <repo>{$ctx:repo}</repo>
            <labels>{$ctx:labels}</labels>
            <owner>{$ctx:owner}</owner>
            <assignee>{$ctx:assignee}</assignee>
         </github.createIssue>
         <respond/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>                                



  • No labels