View Issue Details

IDProjectCategoryView StatusLast Update
0026121mantisbtapi restpublic2019-09-26 11:07
Reportereaaswrm Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityalways
Status assignedResolutionopen 
Product Version2.22.0 
Summary0026121: Problem creating issues with custom fields using REST API
Description

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:

{
    '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

EDIT [dregad] Markdown block quote

TagsNo tags attached.

Activities

dregad

dregad

2019-09-09 10:49

developer   ~0062755

It works for me.

Are you really using single quotes ? If so, please try again with double quotes, as per JSON specification

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes.

dregad

dregad

2019-09-09 10:51

developer   ~0062756

Last edited: 2019-09-09 11:02

View 3 revisions

Also, there seems to be a misplaced }

        'field': {'name': 'Other'}}
        'value': 'MISC', 

should probably be

        'field': {'name': 'Other'}
        'value': 'MISC'}, 

EDIT: And missing comma after "field": {"name": "xxx"}

Make sure you use valid JSON http://json.parser.online.fr/

eaaswrm

eaaswrm

2019-09-12 10:04

reporter   ~0062777

Last edited: 2019-09-12 10:08

View 4 revisions

It looks to be a typo. I'm using Python script to generate that data for me and it uses good JSON encoding (with double quotes). This is the data that is being sent (checked with suggested JSON parser):
<pre><code>
{
"summary": "Test_summary",
"category":
{"name": "RnD Env"},
"project":
{"id": "123"},
"custom_fields":
[
{"field":
{
"id": 69,
"name": "Tool Selection"
},
"value": "Other"}
],
"description": "Test_summary"
}
</code></pre>

dregad

dregad

2019-09-12 19:32

developer   ~0062786

And with this, you get the same error message as previously mentioned, but for Tool Selection instead if IP name custom field ?
What does the definition for that custom field look like ? Does it indeed have id = 69 ? Is Other a valid value for it ?

eaaswrm

eaaswrm

2019-09-17 05:02

reporter   ~0062836

Yes, I get the same error (IP name is no longer required).

[code]
{
"id": 69,
"name": "Tool Selection",
"type": "list",
"default_value": "",
"possible_values": "ToolA | ToolB | ... | Other",
"valid_regexp": "",
"length_min": 0,
"length_max": 0,
"access_level_r": {
"id": 25,
"name": "reporter",
"label": "reporter"
},
"access_level_rw": {
"id": 25,
"name": "reporter",
"label": "reporter"
},
"display_report": true,
"display_update": true,
"display_resolved": false,
"display_closed": false,
"require_report": true,
"require_update": false,
"require_resolved": false,
"require_closed": false
},
[/code]

eaaswrm

eaaswrm

2019-09-26 11:07

reporter   ~0062916

@dregad, do you have any idea what I could try next?

Issue History

Date Modified Username Field Change
2019-09-09 05:27 eaaswrm New Issue
2019-09-09 10:49 dregad Assigned To => dregad
2019-09-09 10:49 dregad Status new => feedback
2019-09-09 10:49 dregad Note Added: 0062755
2019-09-09 10:49 dregad Description Updated View Revisions
2019-09-09 10:51 dregad Note Added: 0062756
2019-09-09 11:00 dregad Note Edited: 0062756 View Revisions
2019-09-09 11:02 dregad Note Edited: 0062756 View Revisions
2019-09-12 10:04 eaaswrm Note Added: 0062777
2019-09-12 10:04 eaaswrm Status feedback => assigned
2019-09-12 10:05 eaaswrm Note Edited: 0062777 View Revisions
2019-09-12 10:05 eaaswrm Note Edited: 0062777 View Revisions
2019-09-12 10:08 eaaswrm Note Edited: 0062777 View Revisions
2019-09-12 19:32 dregad Note Added: 0062786
2019-09-12 19:32 dregad Status assigned => feedback
2019-09-17 05:02 eaaswrm Note Added: 0062836
2019-09-17 05:02 eaaswrm Status feedback => assigned
2019-09-26 11:07 eaaswrm Note Added: 0062916