I'm creating JIRA issues dynamically from my script using Jira REST APIs. In this script, the user can provide the values for the issue fields. Using that information, I'm creating a JSON that is required by the API. But the problem is that not all the fields have the same JSON structure. Some of the fields require nested JSON and some do not, even if the data type is the same.
For, example, the "summary" field does not require nested JSON, but the "description" field requires an Atlassian document JSON structure.
{
'fields': {
'summary': mappings['summary'],
"issuetype": {
"name": issue_type
},
'project': {
'id': project_id
},
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"text": mappings['description'],
"type": "text"
}
]
}
]
}
}
}
Also, the "project" and "issueType" unnecessarily requires the object.
As I'm dynamically creating this JSON structure, how do I know what structure is required by which field?
I couldn't find documentation about this. I'm using this endpoing: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post
Thanks!