Problem REST API - adding issue

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
misu
Posts: 18
Joined: Sep 22, 2008 2:52 pm

Problem REST API - adding issue

Post by misu »

Hello all,
we have mantis 2.8.0 installed with MySQL and on Windows IIS. Now we want to try use REST_API and we have problem with the calling REST API interface. We have tried calling from command line or from powershell (using library from GitHub) - but we still receive error message "{"message":"Summary not specified","code":11 ..." despite the fact that in calling routine is summary field specified - for example:

Code: Select all

curl --location --insecure --request POST "https://mantis.v1.essox.cz/api/rest/index.php/issues/" --header "Authorization: eRVmZRJUPwYMSNh4tX8QxqpcMvDXLi2l" --header "Content-Type: application/json" --data-raw "{  'summary': 'This is a test issue',  'description': 'This is a test description',  'category': {    'name': 'General'  },  'project': {    'name': 'project1'  }}"
Any experience / advice on your site?
Thanks
MiSu

obmsch
Posts: 21
Joined: Mar 26, 2013 5:19 pm

Re: Problem REST API - adding issue

Post by obmsch »

Hello MiSu,

your data-raw is not valid json. Strings need to be double quoted not single(... "summary" : "test", ...).

As your are using IIS, some remarks about that:
  • You need a web.config for url rewrites in api/rest. That was added in 2.20.0, if I remember correctly. If you like to stay with 2.8.0, take a look at the mantis github repo to see what's needed.
  • By default the IIS php fastcgi handler only supports the verbs GET, POST and HEAD. For some of the REST API the verbs DELETE and PATCH need to be added there.
Martin

misu
Posts: 18
Joined: Sep 22, 2008 2:52 pm

Re: Problem REST API - adding issue

Post by misu »

Hello Ombsch,
thank for the tips - we will try it - some of them we have tried already (URL rewrite module, single quoting, ...) but not all together. I'll put the result then.
M.

Post Reply