Data to post to /mantisbt/bug_report_page.php using REST

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
jcordes74
Posts: 8
Joined: 24 Jun 2022, 20:01

Data to post to /mantisbt/bug_report_page.php using REST

Post by jcordes74 »

Hello all!
So I'm trying to use REST to create a new issue because my team will need a script that will generate a ticket automatically when prompted (I read somewhere that this is possible through REST, feel free to share your thoughts if that's not possible.)
When I execute 'requests.get(http:// x /mantisbt/bug_report_page.php)' I get a 200 response which makes me happy (I don't feel comfortable sharing what the server name actually is so I just wrote x here)
Then when I execute 'requests.post(url = http:// x /mantisbt/bug_report_page.php), data = {}) I also get a 200 response which means the connections works but I don't know what data to put in to get the 201 response I'm looking for. Does anyone know what data I need to add into the python dictionary to make this work? Does it have anything to do with the swagger.json file?
rfeldbauer
Posts: 10
Joined: 21 Jul 2021, 22:03

Re: Data to post to /mantisbt/bug_report_page.php using REST

Post by rfeldbauer »

In your bug tracker, you will need to go to the My Account page (API Tokens tab) and create a token for yourself.

Here is documentation on the minimum info you need to create an issue:
https://documenter.getpostman.com/view/ ... 0487eeb853

Change the language at the top to PHP to see the code example...
jcordes74
Posts: 8
Joined: 24 Jun 2022, 20:01

Re: Data to post to /mantisbt/bug_report_page.php using REST

Post by jcordes74 »

Thank you for the response and the link, it's been helpful so far. I'm sorry, I'm still a bit of an amateur with this stuff.

So I'm trying to learn more about curl and I'm going through everything in that document slowly, starting with just getting an issue with GET.
When I run ' curl --location -g --request GET ' (x) /api/rest/issues/0002889' \ --header 'Authorization: test_token' ' I get the following error:
curl: (6) Could not resolve host: --header; Unknown error
curl: (6) Could not resolve host: Authorization; Unknown error

I don't feel comfortable saying my server name, so I replaced it with (x), and I'm fairly certain that that is not the issue. Let me know if anyone thinks otherwise. Also my token name is "test_token". Does anyone know why I'm getting these errors?
rfeldbauer
Posts: 10
Joined: 21 Jul 2021, 22:03

Re: Data to post to /mantisbt/bug_report_page.php using REST

Post by rfeldbauer »

I don't know if it makes a difference, but when I was doing this, I had to put my actual token in there - not the name of the token.
Post Reply