Rest API POST request to create an Insight under a specific Idea

Mindaugas Stasevicius
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 17, 2023

I'm doing an integration from LiveChat to Jira and wish to send POST requests to via Jira API to create Insights under specific Idea task type. However, I am unsure how to receive the custom field ID of the Insight. 

For example, posting comments inside the mentioned Idea is quite simple as you can simply send a POST request via /rest/api/latest/issue/issueID/comment and a new comment is created, but I am unsure of how to achieve this with the custom Insight field.

Any help is appreciated! 

1 answer

1 accepted

0 votes
Answer accepted
habib rahman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2023

Hi @Mindaugas Stasevicius, my name is Habib. Below I might have a solution for you:

 

To create Insights under a specific Idea task type in Jira using its REST API, you need to obtain the custom field ID of the Insight. Here are the steps you can follow to achieve this:

  1. Log in to your Jira account and navigate to the project where your Idea task type is located.
  2. Click on the "Settings" gear icon and select "Issues" from the dropdown menu.
  3. Scroll down to the "Fields" section and locate the custom field for Insights. The name of the field may vary depending on how it was set up in your Jira instance.
  4. Click on the name of the custom field to view its details.
  5. The custom field ID will be displayed in the URL of the page, right after the word "customfield". It will be a numeric value, such as "customfield_10000". Note down this ID for later use.
Once you have obtained the custom field ID, you can use it in your POST request to create Insights under the Idea task type. Here is an example of how to do this:

  1. Construct the URL for the API endpoint to create an issue in Jira. It should look something like this:
  1. Create a JSON object that contains the data for the issue you want to create, including the custom field for Insights. Here is an example of what the JSON object might look like:
```
{
    "fields": {
        "project": {
            "key": "YOUR_PROJECT_KEY"
        },
        "summary": "Issue summary goes here",
        "description": "Issue description goes here",
        "issuetype": {
            "name": "Idea"
        },
        "customfield_CUSTOMFIELD_ID": [
            {
                "value": "Insight value goes here"
            }
        ]
    }
}
```In this example, replace "YOUR_PROJECT_KEY" with the key of your Jira project, and replace "CUSTOMFIELD_ID" with the custom field ID you obtained in step 5 above. You can also add additional fields as needed, such as priority or due date.

  1. Send a POST request to the Jira API endpoint with the JSON object as the request body. Here is an example using Python and the Requests library:
```
import requests
import jsonurl = "https://your-jira-instance.atlassian.net/rest/api/latest/issue"
headers = {
    "Content-Type": "

Please let me know if this helps.

Thank you 

Habib 

Mindaugas Stasevicius
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2023

Thank you for the reply Habib!

 

The Insight custom field is not visible in the list for some reason. It might be because the product used for this field installation was Product Discovery. Not sure though.

Does it change anything?

jazib zaidi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 11, 2025

Error - 

{
"errorMessages": [],
"errors": {
"customfield_11649": "Specify a number for the custom field (below 100,000,000,000,000)"
}
}
@Mindaugas Stasevicius Can you please help me with this?

Thanks,
Jazib

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events