Hyperz Documentation > Products > Community Boards > API Documentation

API Documentation

Hyperz

API Documentation

This guide will walk you through making API requests to the Community Boards API.


Authorization

This guide will discuss with you the process of API authorization.

Sending your API key within your GET / POST request is easy. Just pass a JSON key and value within your request headers.

{
   "authorization": "YOUR_API_KEY"
}

If the authorization is successful, the request will respond with a JSON key of pass as a boolean.

{
   "pass": true,
   "code": 200
}

and if it fails, it will respond the same way, however it will include a reason with the response failure.

{
   "pass": false,
   "reason": "Invalid authorization token provided within the request."
}

Endpoints

Below you will find all documented API endpoints.

GET:

  • /api/get/forum/{forumLink}
  • /api/get/topic/{topicLink}
  • /api/get/user/{userId}
  • /api/get/statistics

POST:

  • /api/post/auditlogs
Name Type Description Required
userbased BOOLEAN Marks if the log is user based. yes
punishment BOOLEAN Marks if the log is a punishment. yes
userid STRING Sets the logs User Id. yes
content STRING The content and reason of the audit log. yes

Examples

Below here you can find an assortment of different examples to make API requests of your own!

All request data is sanitized on the server side to avoid XSS attacks and SQL injection.


JavaScript GET

const axios = require('axios');
callApi();

async function callApi() {
   let response= await axios({
      method: 'get',
      url: 'https://boards.example.com/api/get/statistics',
      headers: {
         "authorization": "YOUR_API_TOKEN"
      }
   });
   if(response.data) {
      console.log(response.data);
   };
};

JavaScript POST

const axios = require('axios');
callApi();

async function callApi() {
   let response= await axios({
      method: 'post',
      url: 'https://boards.example.com/api/post/auditlogs',
      headers: {
         "authorization": "YOUR_API_TOKEN"
      },
      body: {
         "userbased": false,
         "punishment": false,
         "userid": "USER_ID",
         "content": "Your reason for creating the audit log goes here" // Dont include any punctuation at the end
      }
   });
   if(response.data) {
      console.log(response.data);
   };
};

Was this article helpful?

17 out of 33 found this helpful