ConfiForms Jira API Calls (Cloud) receiving error 'You need to post a valid JSON to the service.'

GAVIN Benn February 8, 2025

Hi all,  I'm having issues with creating what I'd call a complex ConfiForm and pushing the data ingo a Jira Create Issue via API.

Please have a look at my Code Block, Error being received and screenshot of fields.

 


Code Block:

 

{"fields": {
	"project": {"key": "CNSP"},
	"issuetype": {"id":10204},
    "customfield_15271": {"id": "CNS Request [entry.cnsrequest.asArray]"},
    "summary": "Summary [entry.summary]",

    "customfield_15231": {"id": "NBN Key Outcome [entry.nbnkeyoutcome.asarray]"},
	"customfield_15232": {"id": "Funding Required? [entry.fundingrequired.asArrayMultiSelect]"},
	"customfield_15230": "Ask of CNS? [entry.askofcns]",
	"customfield_15301": {"id": "Benefits Evaluation [entry.benefitsevaluation.asArray]"},
	"customfield_15510": [{"id": "Customer Segment [entry.segment.asArrayMultiSelect]"}],
	"customfield_15235": [{"id": "RSP Impact [entry.rspimpact.asArrayMultiSelect]"}],
	"customfield_15236": [{"id": "Impacted Technology [entry.technology.asArrayMultiSelect]"}],
	"customfield_13300": "Problem Statement [entry.problemstatement]",
    "reporter": {"id": "[entry._user]"},
	"customfield_15233": {"id": "Requesting Business Unit [entry.requestingbusinessunit.asArray]"},
	"customfield_11900": "Expected Business Outcome [entry.expectedbusinessoutcome]"
}}

 


Error:

You need to post a valid JSON to the service. This is what you are trying to post: {"fields": { "project": {"key": "CNSP"}, "issuetype": {"id":10204}, "customfield_15271": {"id": "CNS Request "24178""}, "summary": "Summary Test", "customfield_15231": {"id": "NBN Key Outcome "}, "customfield_15232": {"id": "Funding Required? {"value":"24117"}"}, "customfield_15230": "Ask of CNS? Test", "customfield_15301": {"id": "Benefits Evaluation "No""}, "customfield_15510": [{"id": "Customer Segment "}], "customfield_15235": [{"id": "RSP Impact {"value":"No RSP Impact"}"}], "customfield_15236": [{"id": "Impacted Technology "}], "customfield_13300": "Problem Statement Test", "reporter": {"id": "712020:e5adf728-b1a6-451e-9556-3710ac8fe91a"}, "customfield_15233": {"id": "Requesting Business Unit "24121""}, "customfield_11900": "Expected Business Outcome Test" }} Original error: Expected a ',' or '}' at 117 [character 47 line 4]

 


Fields being used:

Form fields.png

1 answer

0 votes
Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 8, 2025

Hi @GAVIN Benn 

There is nothing more to say than ConfiForms does - the JSON you are constructing is not valid and will not be accepted by Jira

ConfiForms Jira helper shows you what structure the field accepts and ConfiForms offers lots of functions to transform the value https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

So instead of something like

"customfield_15235": [{"id": "RSP Impact [entry.rspimpact.asArrayMultiSelect]"}]

You need the field to produce the value as array of objects that have an id property

"customfield_15235": [[entry.rspimpact.asArrayOfKVPairs(id)]],

And so on...

Alex

GAVIN Benn February 10, 2025

Thanks Alex, any additional tips for troubleshooting the JSON  I have?

Alex Medved _ConfiForms_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 11, 2025

Have you fixed those fields that I have mentioned? What JSON mapping do you have now?

GAVIN Benn February 11, 2025

Thanks Alex, I'm looking to try and add this into my form today.  Haven't been able to get back to this build until today.

Suggest an answer

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

Atlassian Community Events