Jira Cloud: Discover Issue Types and Required Fields
See more Jira Examples
List a project's available issue types, then retrieve the creation fields for the type selected by name. Required fields and allowed values depend on project configuration. Inspect the returned field metadata before adapting the create-issue example. The current project-scoped metadata endpoints replace the deprecated general create-metadata endpoint.
The code lists field IDs and required flags, plus the full field metadata for each page (including schemas and allowed values). Field names are display labels; submit the returned field ID, such as customfield_10042. A field can be absent from the create screen or require a project-specific value.
The code uses an Atlassian account email and an API token without scopes with the site URL. For a scoped API token, keep Basic authentication and change baseUrl to https://api.atlassian.com/ex/jira/YOUR_CLOUD_ID. For OAuth2, use that gateway URL, omit Login/Password/BasicAuth, and set http.AuthToken to the access token. See API token authentication and OAuth2 authorization. The account must have permission for the operation; OAuth scopes do not grant additional Jira permissions.
Targets Jira Cloud. Jira Data Center has a separate REST API and may require different paths, authentication, or payloads.
Atlassian REST API documentation
Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
set http = CreateObject("Chilkat.Http")
http.RequireSslCertVerify = 1
http.BasicAuth = 1
' Read these credentials from private application configuration.
http.Login = "YOUR_ATLASSIAN_EMAIL"
http.Password = "YOUR_API_TOKEN"
baseUrl = "https://your-domain.atlassian.net"
http.Accept = "application/json"
set url = CreateObject("Chilkat.StringBuilder")
set resp = CreateObject("Chilkat.HttpResponse")
set reply = CreateObject("Chilkat.JsonObject")
success = http.SetUrlVar("projectKey","PROJECT")
issueTypeName = "Task"
issueTypeId = ""
matches = 0
typesStart = 0
typesMore = 1
set typesOffset = CreateObject("Chilkat.StringBuilder")
Do While (typesMore = 1)
typesOffset.Clear
success = typesOffset.AppendInt(typesStart)
success = http.SetUrlVar("offset",typesOffset.GetAsString())
success = url.SetString(baseUrl)
success = url.Append("/rest/api/3/issue/createmeta/{$projectKey}/issuetypes?startAt={$offset}&maxResults=50")
success = http.HttpNoBody("GET",url.GetAsString(),resp)
If (resp.StatusCode = 0) Then
outFile.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
WScript.Quit
End If
If ((success <> 1) Or (resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
outFile.WriteLine("Request failed. HTTP " & resp.StatusCode)
If (resp.StatusCode = 429) Then
outFile.WriteLine("Rate limited. Retry-After: " & resp.GetHeaderField("Retry-After"))
End If
' Inspect this response locally; it can contain private Jira data.
outFile.WriteLine(resp.BodyStr)
WScript.Quit
End If
success = reply.Load(resp.BodyStr)
If (success <> 1) Then
outFile.WriteLine("Expected a JSON object in the response.")
WScript.Quit
End If
If (reply.JsonTypeOf("issueTypes") <> 4) Then
outFile.WriteLine("Expected an array: issueTypes")
WScript.Quit
End If
typesCount = reply.SizeOfArray("issueTypes")
typesIndex = 0
Do While (typesIndex < typesCount)
reply.I = typesIndex
outFile.WriteLine(reply.StringOf("issueTypes[i].name") & " ID: " & reply.StringOf("issueTypes[i].id"))
If (reply.StringOfEquals("issueTypes[i].name",issueTypeName,1) = 1) Then
issueTypeId = reply.StringOf("issueTypes[i].id")
matches = matches + 1
End If
typesIndex = typesIndex + 1
Loop
typesStart = typesStart + typesCount
typesMore = (typesStart < reply.IntOf("total"))
If ((typesMore = 1) And (typesCount = 0)) Then
outFile.WriteLine("Pagination made no progress; stopping.")
WScript.Quit
End If
Loop
If (matches <> 1) Then
outFile.WriteLine("Select one unambiguous issue type from the returned list.")
WScript.Quit
End If
success = http.SetUrlVar("issueTypeId",issueTypeId)
fieldsStart = 0
fieldsMore = 1
set fieldsOffset = CreateObject("Chilkat.StringBuilder")
Do While (fieldsMore = 1)
fieldsOffset.Clear
success = fieldsOffset.AppendInt(fieldsStart)
success = http.SetUrlVar("offset",fieldsOffset.GetAsString())
success = url.SetString(baseUrl)
success = url.Append("/rest/api/3/issue/createmeta/{$projectKey}/issuetypes/{$issueTypeId}?startAt={$offset}&maxResults=50")
success = http.HttpNoBody("GET",url.GetAsString(),resp)
If (resp.StatusCode = 0) Then
outFile.WriteLine("No HTTP response was received. Check connectivity and TLS settings.")
WScript.Quit
End If
If ((success <> 1) Or (resp.StatusCode < 200) Or (resp.StatusCode >= 300)) Then
outFile.WriteLine("Request failed. HTTP " & resp.StatusCode)
If (resp.StatusCode = 429) Then
outFile.WriteLine("Rate limited. Retry-After: " & resp.GetHeaderField("Retry-After"))
End If
' Inspect this response locally; it can contain private Jira data.
outFile.WriteLine(resp.BodyStr)
WScript.Quit
End If
success = reply.Load(resp.BodyStr)
If (success <> 1) Then
outFile.WriteLine("Expected a JSON object in the response.")
WScript.Quit
End If
If (reply.JsonTypeOf("fields") <> 4) Then
outFile.WriteLine("Expected an array: fields")
WScript.Quit
End If
' Full metadata includes field schemas and allowed values.
outFile.WriteLine(reply.Emit())
fieldsCount = reply.SizeOfArray("fields")
fieldsIndex = 0
Do While (fieldsIndex < fieldsCount)
reply.I = fieldsIndex
outFile.WriteLine(reply.StringOf("fields[i].fieldId") & " " & reply.StringOf("fields[i].name") & " Required: " & reply.BoolOf("fields[i].required"))
fieldsIndex = fieldsIndex + 1
Loop
fieldsStart = fieldsStart + fieldsCount
fieldsMore = (fieldsStart < reply.IntOf("total"))
If ((fieldsMore = 1) And (fieldsCount = 0)) Then
outFile.WriteLine("Pagination made no progress; stopping.")
WScript.Quit
End If
Loop
outFile.Close