Creates an issue or a sub-task from a JSON representation.
curl -X POST --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"fields": {
"project": {
"id": "10000"
},
"summary": "something is wrong",
"issuetype": {
"id": "10000"
},
"assignee": {
"name": "matt"
},
"priority": {
"id": "3"
},
"labels": [
"bugfix",
"blitz_test"
],
"description": "description",
"fixVersions": [
{
"id": "10001"
}
],
"customfield_10005": "blah blah"
}
}' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue'
Dim rest As New Chilkat.Rest
Dim success As Boolean
// URL: https://your-domain.atlassian.net/rest/api/2/issue
Dim bTls As Boolean
bTls = True
Dim port As Int32
port = 443
Dim bAutoReconnect As Boolean
bAutoReconnect = True
success = rest.Connect("your-domain.atlassian.net",port,bTls,bAutoReconnect)
If (success <> True) Then
System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
System.DebugLog(rest.LastErrorText)
Return
End If
rest.SetAuthBasic("jira@example.com","JIRA_API_TOKEN")
Dim json As New Chilkat.JsonObject
json.UpdateString("fields.project.id","10000")
json.UpdateString("fields.summary","something is wrong")
json.UpdateString("fields.issuetype.id","10000")
json.UpdateString("fields.assignee.name","matt")
json.UpdateString("fields.priority.id","3")
json.UpdateString("fields.labels[0]","bugfix")
json.UpdateString("fields.labels[1]","blitz_test")
json.UpdateString("fields.description","description")
json.UpdateString("fields.fixVersions[0].id","10001")
json.UpdateString("fields.customfield_10005","blah blah")
rest.AddHeader("Content-Type","application/json")
rest.AddHeader("Accept","application/json")
Dim sbRequestBody As New Chilkat.StringBuilder
json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST","/rest/api/2/issue",sbRequestBody,sbResponseBody)
If (success <> True) Then
System.DebugLog(rest.LastErrorText)
Return
End If
Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
System.DebugLog("Response Status Code = " + Str(respStatusCode))
System.DebugLog("Response Header:")
System.DebugLog(rest.ResponseHeader)
System.DebugLog("Response Body:")
System.DebugLog(sbResponseBody.GetAsString())
Return
End If
Dim jsonResponse As New Chilkat.JsonObject
jsonResponse.LoadSb(sbResponseBody)
Dim id As String
Dim key As String
Dim self As String
id = jsonResponse.StringOf("id")
key = jsonResponse.StringOf("key")
self = jsonResponse.StringOf("self")
{
"id": "10023",
"key": "SCRUM-24",
"self": "https://chilkat.atlassian.net/rest/api/2/issue/10023"
}