Weblutions Documentation > Product Documentation > FaxTrack > API Example

API Example

This is a quick example for using the API within FaxTrack. These examples use the form-data NPM package to send files through the request. This is not required though.

The 'title' field is required in all requests.

Create Issue

var FormData = require('form-data');
const form = new FormData();
form.append('title', 'TITLE');
form.append('description', `DESCRIPTION_SUPPORTS_MARKDOWN`);
form.append('category', 'CATEGORY_NAME');
form.append('versions', 'AFFECTED_VERSIONS');
form.append('labels', 'LABELS');
form.append('links', 'LINKS_COMMA_SEPERATED');
form.append('file', fs.createReadStream('./PATH_TO_FILE'));

let checkres = await axios({
    method: 'post',
    url: `https://bugs.example.com/api/issue/PROJECT_ID`,
    headers: {
        'Authorization': 'API_TOKEN_HERE',
        ...form.getHeaders()
    },
    data: form
}).catch(function(err) {
    throw err;
});
console.log(checkres.status)

Create Feedback

var FormData = require('form-data');
const form = new FormData();
form.append('title', 'TITLE');
form.append('description', `DESCRIPTION_SUPPORTS_MARKDOWN`);
form.append('labels', 'LABELS');
form.append('links', 'LINKS_COMMA_SEPERATED');
form.append('file', fs.createReadStream('./PATH_TO_FILE'));

let checkres = await axios({
    method: 'post',
    url: `https://bugs.example.com/api/feedback/PROJECT_ID`,
    headers: {
        'Authorization': 'API_TOKEN_HERE',
        ...form.getHeaders()
    },
    data: form
}).catch(function(err) {
    throw err;
});
console.log(checkres.status)

Create User

POST /api/accounts

Creates an account with the provided details.

Parameters:

Authorization [Header] The API key that's set on the staff panel
username [Body] [Required] The username for the account
avatar [Body] A link to a profile photo for the account
discordID [Body] A Discord ID for the account
banned [Body] Boolean value whether the account should be banned or not. Defaults to false

Response: [Expand]

401 - Unauthorized - Incorrect API token provided.
400 - Not Complete - Username not provided in request.
201 - Created - userID

Create Feedback Topic

POST /api/feedback/:projectID

Creates a feedback topic on the provided project.

Parameters:

Authorization [Header] The API key that's set on the staff panel
title [Body] [Required] The title for the topic
description [Body] [Required] The description/body to use in the topic
labels [Body] Labels to add to the topic, comma separated
links [Body] Links to add to the topic, comma separated
userId [Body] The user ID to create the topic as. Defaults to the tracker bot if none provided
file [Files] Attachment to add to the topic. Only one is supported

Response: [Expand]

401 - Unauthorized - Incorrect API token provided
409 - Conflict - Duplicate content
400 - Bad Request - Invalid project ID
201 - Created - Returns a link to the topic

Create Issue Topic

POST /api/issue/:projectID

Creates a issue topic on the provided project.

Parameters:

Authorization [Header] The API key that's set on the staff panel
title [Body] [Required] The title for the topic
description [Body] [Required] The description/body to use in the topic
labels [Body] Labels to add to the topic, comma separated
links [Body] Links to add to the topic, comma separated
userId [Body] The user ID to create the topic as. Defaults to the tracker bot if none provided
file [Files] Attachment to add to the topic. Only one is supported

Response: [Expand]

401 - Unauthorized - Incorrect API token provided
409 - Conflict - Duplicate content
400 - Bad Request - Invalid project ID
201 - Created - Returns a link to the topic

Get User

GET /api/accounts/:id

Gets an account based on their ID or Discord ID

Parameters:

Authorization [Header] The API key that's set on the staff panel
accountId [Param] [Required] The account ID to search for, can be an account ID or Discord user ID

Response: [Expand]

{
  "id": "2",
  "username": "email@example.com",
  "permType": 1,
  "profileImg": "/attachments/CK6II7iKEy-dSwIuoYjAcAZES.png",
  "banned": 0,
  "discordId": "",
  "createdAt": "1655726232638"
}


Suggest an edit

Review this page

FAXES

1 recommend this page