Problem creating issues with custom fields using REST API

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mwas01
Posts: 7
Joined: May 29, 2018 5:02 am
Location: Sweden

Problem creating issues with custom fields using REST API

Post by mwas01 » Sep 05, 2019 9:20 am

Hi,

I'm trying to create new issues using Mantis REST API but I'm getting a problem with custom fields, I'm following guidlines from Postman and sending that data in json:

Code: Select all

{
	'summary': 'Test_summary', 
	'project': {'id': '123'}, 
	'custom_fields': [
		{
		'field': {'name': 'IP name'}
		'value': 'Test', 
		}, 
		{
		'field': {'name': 'Other'}}
		'value': 'MISC', 
		], 
	'description': 'Test_summary', 
	'category': {'name': 'RnD Env'}
	}
But I'm getting answer back that custom field is empty:

"Invalid custom field 'IP name' value.","code":11,"localized":"A necessary field \"IP name\" was empty. Please recheck your inputs."

Mantis v. 2.22 but same problem was present in previous install v 2.14

efrat
Posts: 6
Joined: May 06, 2012 1:59 pm

Re: Problem creating issues with custom fields using REST API

Post by efrat » Oct 26, 2019 4:15 am

Hi,
As far as I know you would need to add id to the custom field too. and I think you missed located one of the the closing }. Try like this:
'custom_fields': [
{
'field': {'name': 'IP name','id':'1'}
'value': 'Test',
},
{
'field': {'name': 'Other',,'id':'2'}
'value': 'MISC',
}
],

Post Reply