Rest API

General discussion of Mantis.

Moderators: Contributor, Developer

Rest API

Postby 7h3ju57 » Jun 13, 2017 11:43 am

anyone successfully use the rest api?

I've tried via web browser and curl but always comes up with a 404.

I've tried enabling token authentication via $g_webservice_rest_enabled = ON;
Still no dice.
there is not much documentation on this feature either.

any help or suggestions would be greatly appreciated.
Posts: 6
Joined: May 05, 2017 3:36 pm

Re: Rest API

Postby cdelaunay » Sep 07, 2017 3:53 am

Same here.
We just installed version 2.6 of mantis.
An we would like to take advantage of the existing REST API functionality.
After looking for hours, we are not able to find any documentation on the web.
could someone give pointers to some sort of documentation around this REST API ?
Thanks in advance
Posts: 1
Joined: Sep 07, 2017 3:49 am

Re: Rest API

Postby Morettic » Oct 16, 2017 12:02 pm

Yes i did. Can list issues but found no documentation to write a client to it. Need to add ticket(issue) using rest API for my mobile APP. Any ideia?
Posts: 3
Joined: Oct 16, 2017 11:26 am

Re: Rest API

Postby Morettic » Oct 16, 2017 1:47 pm

Im trying to write a simple PHP Client to Add Issues to the Mautic. Like the following PHP code....
Code: Select all

 * @author LAMM <>


class BugTracker extends stdClass {

    public static function addIssueBugTracker($pUser, $pPass, $projectID, $category, $summary, $desc) {

        $fields = array(
            'username' => $pUser,
            'password' => $pPass,
            'category' => $category,
            'summary' => $summary,
            'description' => $desc,
            'project' => $projectID


//url-ify the data for the POST
        foreach ($fields as $key => $value) {
            $fields_string .= $key . '=' . $value . '&';
        rtrim($fields_string, '&');

//open connection
        $ch = curl_init();

//set the url, number of POST vars, POST data
        curl_setopt($ch, CURLOPT_URL, BUGTRACKER_REST);
        curl_setopt($ch, CURLOPT_POST, count($fields));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);

//execute post
        $result = curl_exec($ch);


//close connection


Also changed issues_rest.php seems like no parameter is coming for username and password so....

Code: Select all
function rest_issue_add( \Slim\Http\Request $p_request, \Slim\Http\Response $p_response, array $p_args ) {
   $t_issue = $p_request->getParsedBody();

       // var_dump($t_issue);
        //echo "dadasdasd";die;
   $t_result = mc_issue_add( /* username */ 'mobXXXXXX', /* password */ 'm0bXXXXX', $t_issue );

Callback is empty. Also would like to know how to add extra fields. Any ideia?
Posts: 3
Joined: Oct 16, 2017 11:26 am

Re: Rest API

Postby Morettic » Oct 16, 2017 3:25 pm

Code: Select all

 * MantisBT / MantisHub PHP Client
 * @author Victor Boctor (vboctor)
 * @license MIT License (MIT)
 * Copyright (c) MantisHub - Victor Boctor
 * All rights reserved.

namespace MantisHub;
//Missing until i fix it or dont work on Slim custom routes. below
use SoapClient;

I could connect at Soap API but after fix a BUG! needs uses SoapClient!!!!!!!!!!!!!
Posts: 3
Joined: Oct 16, 2017 11:26 am

Re: Rest API

Postby sarahah » Oct 17, 2017 5:55 am

I want to call Salesforce via REST and I'm able to do a GET, but I can not make any API calls that require a POST. kindly help :(
Posts: 1
Joined: Sep 07, 2017 7:39 am

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests