Problem REST API - adding issue

General discussion of Mantis.

Moderators: Developer, Contributor

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

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: 26
Joined: 26 Mar 2013, 22:19

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: 22 Sep 2008, 19:52

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