View Issue Details

IDProjectCategoryView StatusLast Update
0026121mantisbtapi restpublic2019-11-18 08:10
Reportereaaswrm Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionno change required 
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

Last edited: 2019-11-02 06:56

View 2 revisions

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

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

eaaswrm

2019-09-26 11:07

reporter   ~0062916

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

dregad

dregad

2019-11-02 06:59

developer   ~0063049

Sorry for the delayed response.

do you have any idea what I could try next?

No I don't. Especially considering that you have not provided information regarding the CF's definition.

atrol

atrol

2019-11-17 08:49

developer   ~0063109

eaaswrm,

You did not provide feedback; I am therefore resolving this issue as "no change required".

Feel free to reopen the issue at a later time and provide the requested information.

wilfried2006

wilfried2006

2019-11-18 08:10

reporter   ~0063110

it doesnt work. Lets try something else.

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
2019-11-02 06:56 dregad Note Edited: 0062836 View Revisions
2019-11-02 06:59 dregad Assigned To dregad =>
2019-11-02 06:59 dregad Status assigned => feedback
2019-11-02 06:59 dregad Note Added: 0063049
2019-11-17 08:49 atrol Assigned To => dregad
2019-11-17 08:49 atrol Status feedback => resolved
2019-11-17 08:49 atrol Resolution open => no change required
2019-11-17 08:49 atrol Note Added: 0063109
2019-11-18 08:10 wilfried2006 Note Added: 0063110