API Documentation

This API provides access to suggestions and org data for a given organization. Below are the available endpoints and how to use them.

1. Get All Suggestions

Endpoint: https://suggest.logick.live/api/:orgId/suggestions/get/all

Method: GET

Path Parameters:

    orgId (string): The unique identifier for the organization.

Headers:

    Authorization: The Bearer token in the format Bearer <token>

Response:

200 OK: Returns a list of all suggestions for the specified organization.

401 Unauthorized: The Authorization header is missing or invalid.

403 Forbidden: The token does not match the stored token for the organization.

204 No Content : No organization found with the given orgId.

500 Internal Server Error: If there is an issue fetching suggestions from the database.

Example Request:

GET https://suggest.logick.live/api/org123/suggestions/get/all
Authorization: Bearer my-api-token

Example Response:

[
  {
    "id": 1,
    "title": "Suggestion 1",
    "description": "Description of Suggestion 1"
  },
  {
    "id": 2,
    "title": "Suggestion 2",
    "description": "Description of Suggestion 2"
  }
]

2. Get One Suggestion

Endpoint: https://suggest.logick.live/api/:orgId/suggestions/get/one

Method: GET

Path Parameters:

    orgId (string): The unique identifier for the organization.

Headers:

    Authorization: The Bearer token in the format Bearer <token>
    SuggestionId: The ID of the specific suggestion you want to retrieve.

Response:

200 OK: Returns the details of the specific suggestion identified by SuggestionId.

401 Unauthorized: The Authorization header is missing or invalid.

403 Forbidden: The token does not match the stored token for the organization.

204 No Content : No organization found with the given orgId or no suggestion found with the provided suggestionId.

500 Internal Server Error: If there is an issue fetching suggestions from the database.

Example Request:

GET https://suggest.logick.live/api/org123/suggestions/get/one
Authorization: Bearer my-api-token
SuggestionId: 1

Example Response:

{
  "id": 1,
  "title": "Suggestion 1",
  "description": "Description of Suggestion 1"
}

3. Create Suggestion

Endpoint: https://suggest.logick.live/api/:orgId/suggestions/create

Method: POST

Path Parameters:

    orgId (string): The unique identifier for the organization.

Headers:

    Authorization: The Bearer token in the format Bearer <token>

Request Body:

{
  "user": "John Doe",      // (string) The name of the user submitting the suggestion.
  "content": "Suggestion content goes here."  // (string) The content of the suggestion.
}

Response:

200 OK: Returns the details of the newly created suggestion.

401 Unauthorized: The Authorization header is missing or invalid.

403 Forbidden: The token does not match the stored token for the organization or the token is invalid.

204 No Content : No organization found with the given orgId.

500 Internal Server Error: If there is an issue creating the suggestion.

Example Request:

POST https://suggest.logick.live/api/org123/suggestions/create
Authorization: Bearer my-api-token
Content-Type: application/json

{
  "user": "John Doe",
  "content": "I think the website could use a dark mode option."
}

Example Response:

{
  "id": "abc123xyz",
  "name": "John Doe",
  "created": 1678851300000,
  "content": "I think the website could use a dark mode option.",
  "origin": "API",
  "status": 0
}

4. Get Org

Endpoint: https://suggest.logick.live/api/:orgId/get

Method: GET

Path Parameters:

    orgId (string): The unique identifier for the organization.

Headers:

    Authorization: The Bearer token in the format Bearer <token>

Response:

200 OK: Returns the details of the newly created suggestion.

401 Unauthorized: The Authorization header is missing or invalid.

403 Forbidden: The token does not match the stored token for the organization or the token is invalid.

204 No Content : No organization found with the given orgId.

500 Internal Server Error: If there is an issue getting the org.

Example Request:

GET https://suggest.logick.live/api/org123/get
Authorization: Bearer my-api-token
Content-Type: application/json

Example Response:

{
  "id": "org123",
  "name": "OrgName",
  "created": "Date",
  "owner": {name: "Owner Name", id: "Owner Id"},
  "publicSuggestions": { enabled: ture || false, link: "https://suggest.logick.live/org/org123/suggestions"},
  webhooks: {
    webhookID12345: { event: '4', url: 'https://webhook.example.come/webhook' },
    },
  discord: {
    channel: { id: 'channelId', name: 'channelName' },
    server: { id: 'serverId', name: 'serverName' },
    connected: true || false,
    active: true || false
  }
}

5. Get Org Members

Endpoint: https://suggest.logick.live/api/:orgId/get/members

Method: GET

Path Parameters:

    orgId (string): The unique identifier for the organization.

Headers:

    Authorization: The Bearer token in the format Bearer <token>

Response:

200 OK: Returns the details of the newly created suggestion.

401 Unauthorized: The Authorization header is missing or invalid.

403 Forbidden: The token does not match the stored token for the organization or the token is invalid.

204 No Content : No organization found with the given orgId.

500 Internal Server Error: If there is an issue getting the members.

Example Request:

GET https://suggest.logick.live/api/org123/get/members
Authorization: Bearer my-api-token
Content-Type: application/json

Example Response:

[
  {
    id: 'userid123',
    joined: { _seconds: 1740438935, _nanoseconds: 249000000 },
    name: 'userName',
    role: 'usersRole'
  },
  {
    id: 'userid1234',
    joined: { _seconds: 1740624127, _nanoseconds: 416000000 },
    name: 'userName1',
    role: 'usersRole'
  }
]
Please note, roles will be shown as a number.

Please note, roles will be shown as a number.

0: Owner

0: Owner

0: Owner

Error Handling

401 Unauthorized: The Authorization header is missing or invalid. This occurs when the token is not in the correct Bearer <token> format or the token does not match the one stored in the database.

403 Forbidden: The token provided does not match the token stored in the organization’s Firestore record.

204 No Content : The organization or suggestion does not exist.

500 Internal Server Error: An error occurred while processing the request.

Axios Request Example

Get All Suggestions:

axios.get('https://suggest.logick.live/api/<orgId>/suggestions/get/all', {
  headers: {
    'Authorization': 'Bearer <your_token>'
  }
})
.then(response => {
  console.log('Suggestions:', response.data);
})
.catch(error => {
  console.error('Error:', error.response ? error.response.data : error.message);
});

Get One Suggestion:

axios.get('https://suggest.logick.live/api/<orgId>/suggestions/get/one', {
  headers: {
    'Authorization': 'Bearer <your_token>',
    'SuggestionId': '<suggestion_id>'
  }
})
.then(response => {
  console.log('Single Suggestion:', response.data);
})
.catch(error => {
  console.error('Error:', error.response ? error.response.data : error.message);
});

Create Suggestion:

axios.post('https://suggest.logick.live/api/<orgId>/suggestions/create', {
  user: '<user_name>',
  content: '<suggestion_content>' 
}, {
  headers: {
    'Authorization': 'Bearer <your_token>',
    'Content-Type': 'application/json'
  }
})
.then(response => {
  console.log('Suggestion Created:', response.data);
})
.catch(error => {
  console.error('Error:', error.response ? error.response.data : error.message);
});

Get Org:

axios.get('https://suggest.logick.live/api/<orgId>/get', {
  headers: {
    'Authorization': 'Bearer <your_token>'
  }
})
.then(response => {
  console.log('Org Data:', response.data);
})
.catch(error => {
  console.error('Error:', error.response ? error.response.data : error.message);
});

Rules

We reserve the right to monitor API use for each organization to assure compliance and to ensure our API isn't being flooded with requests

Rate Limits: 500 requests per 15 minutes for each token, after this you will be ratelimited for 5 minutes

Abuse: Abuse of our API will result in the organization getting deleted, and the owner of the org getting banned from using Logick