Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MantisBT Create Support Ticket API

A small TypeScript project for creating MantisBT support tickets through the MantisBT REST API.

It builds a MantisBT issue payload, sends it to /api/rest/issues, and returns the created issue ID with the raw API response.

Requirements

Installation

git clone https://github.com/ItsLeon15/MantisBT-Create-Support-Ticket-API.git
cd MantisBT-Create-Support-Ticket-API
npm install

Usage

Import createSupportTicket and pass in the ticket data:

import { createSupportTicket } from "./logic.js";

const ticket = await createSupportTicket({
	summary: "Login button does not work",
	description: "When clicking the login button, nothing happens.",
	project: {
		id: 1,
	},
	category: {
		id: 1,
	},
});

console.log(ticket.issueId);
console.log(ticket.raw);

Examples

Required Fields

summary
description
project
category

Optional Fields

steps_to_reproduce
reporter
handler
priority
severity
resolution
os
platform
os_version
tags
custom_fields
files
notes

References

Some MantisBT values can be referenced by ID or name.

project: {
    id: 1
}
project: {
    name: "Example Project"
}

Users can be referenced by ID, username, or email.

handler: {
    id: 1
}
handler: {
    name: "administrator"
}
handler: {
    email: "admin@example.com"
}

File Attachments

File content must be base64 encoded.

files: [
    {
        name: "example.txt",
        content: Buffer.from("Example file content").toString("base64"),
    }
]

Response Format

createSupportTicket returns:

{
    issueId: number | null;
    raw: MantisCreateIssueResponseBody | null;
}

Project Structure

├── src
│   ├── fullTicket.ts
│   ├── logic.ts
│   ├── minimalTickett.ts
│   └── type.ts
├── .env.example
├── .gitignore
├── README.md
├── package.json
└── tsconfig.json

Notes

  • The project and category must already exist in MantisBT.
  • Custom fields must already exist and be linked to the selected project.
  • Tags must already exist unless the API user can create or apply them.
  • Attachments must be base64 encoded.
  • The API token user must have permission to create issues.
  • Some fields may require extra MantisBT permissions.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A simple Typescript project to create support tickets using the MantisBT API

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages