[Official] RestAPI: How to use it and information regarding it.

Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
This is used for the official forum announcements from the staff team.
Status
Not open for further replies.

GameServersHub

CEO
Joined
Jul 5, 2021
Messages
155
We recognize that many members of our platform, and more specifically those who author resources, are actively seeking methods in which they can automate their interactions with our platform. Whilst such automation in the form of scraping or otherwise is known to be a violation of our Terms of Service, we've developed and deployed this REST API in order for us to satisfy these requests in a controlled manner.

This API is only made available to members with an active Verification upgrade. No exceptions. Access is liable to be removed at any time and for any reason, though the most likely cause may be abuse. Restricted and banned members will also be denied access even if they still hold an active Ultimate upgrade.

Would you like your resource to have a licensing system and update/version checking without the need to self-host anything? Would you like to develop an identity verification system? Would you like to synchronize replies to your threads within a Discord channel? Would you like to display your resource's reviews on your website? All of this and much more can be achieved via this API.

We're always wanting to improve the functionality of this API along with the usefulness of this documentation. As a result, we've defined clear versioning for future interoperability in the event that we need to drastically change this API's behavior in significant ways. If you feel improvements can be made in any area, we encourage the use of our site's suggestions forum to communicate those to us.

The base URL and current version is as follows: https://gameservershub.com/forums/api/framework/<endpoint>


Usage Policies​


Violations of the following policies may lead to onsite punishments or an outright ban from utilising our API in serve circumstances:
  • Don't distribute your private token or neglect to refresh it if discovered.
  • Don't use your private token to provide other members unrestricted access to the API.
  • Don't provide a hosted interface to the API for any business or service of which you are not the owner.
  • Don't fail to respect and adhere to dynamic rate limiting errors.

Authentication​


An API token is required to access all of our endpoints and can be generated via the API Credentials page. To authenticate with our API, the 'Authorization' HTTP header must be present in all requests containing your API token. If you're receiving an error suggesting this header was missing or not in the expected format, please read through this section thoroughly.

We support two types of tokens that grant varied access to our endpoints. The primary token type, 'Private', grants access to all public endpoints and as the name suggests, should be kept private. This token type grants access to view and modify potentially sensitive data specific to your account.

Alternatively, we also support a secondary 'Shared' token type that grants very limited access to our API and can be shared with other members or within your products. This token type grants access to public validation of resource licenses, public version checking and public update checking. However, its scope is limited to your account and the resources you've authored solely.

We expect the 'Authorization' header to be in the following format:


Authorization: XF-Api-Key


An example of this header might be:


Authorization: xXoIjvQ6G8UmUPufZWxN-Kkyd54Js_bY




Response Handling​


All responses from our API endpoints will include a top-level object detailing information about the response. It will always include a 'result' field with a value of either 'success' or 'error'. Use this field along with the response's status code to handle unexpected errors.

An example of a successful response:


Code:


JSON:
{

"result": "success",

"data": "ok"

}
{

  "result": "success",

  "data": "ok"

}


An example of an errored response:


Code:


JSON:
{

"result": "error",

"error": {

"code": "HeaderMissingError",

"message": "The 'Authorization' header was not present."

}

}
{

  "result": "error",

  "error": {

   "code": "HeaderMissingError",

   "message": "The 'Authorization' header was not present."

  }

}

Formatting​


By default, all responses from our API endpoints are returned in the non-pretty JSON format. This behavior can be altered for any request via query parameters. We currently support JSON, XML, and YAML formatting only with JSON being the only one of the three to support pretty printing. More formats may be supported in the future.

The following query parameters are available:
  • 'format' - accepts either 'json', 'xml', or 'yaml'.
  • 'pretty' - accepts either 'true' or 'false'.


Similarly, request bodies for CREATE/UPDATE operations support the same formats. The request's 'Content-Type' header must be set appropriately:
  • JSON - 'application/json'
  • XML - 'application/xml'
  • YAML - 'text/yaml'

Sorting​


For all endpoints that return a list of objects, you also have the ability to sort and order them via query parameters. Results are paginated with 20 objects per page and fields you can sort by are defined on a per endpoint basis.

The following query parameters are available:
  • 'sort' - accepts object field names (see endpoint documentation below).
  • 'order' - accepts either 'asc' (ascending) or 'desc' (descending).
  • 'page' - accepts an integer greater than or equal to 1.

Rate Limiting​

  1. We apply rate-limiting rules per connection IP address as well as per account. The latter means that when using a shared token, you may hit a rate limit not due to your own actions, but the actions of other individuals also using that same shared token. Note also that rate limits for READ operations (ie. GET) are independent of those applied to WRITE operations (ie. POST, PATCH, DELETE).
  2. Rate limits may be adjusted so to avoid the hard-coding of these rates into products or wrappers, we won't be disclosing them within this documentation. Instead, we include a 'Retry-After' header when you hit a rate limit which we expect members to adhere to. Note that this header provides a millisecond granularity, rather than the second granularity set out by the header's HTTP specification.
 
Last edited:

List of all the REST API endpoints below​

Alerts
List unread alerts

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/alerts

Sortable Fields
"caused_member_id"
"content_type"
"content_id"
"alert_type"
"alert_date" (default)

Response Data
An array of Alert objects.
Mark unread alerts as read

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/alerts

Body Parameters
"read" - expects a boolean (should always be true)
Conversations
List unread conversations

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/conversations

Sortable Fields
"creation_date"
"creator_id"
"title"
"reply_count"
"last_message_date" (default)
"last_read_date"

Response Data
An array of Conversation objects.
Start a new conversation

Token Type
Private

Method/URL
POST https://gameservershub.com/forums/api/framework/conversations

Body Parameters
"recipient_ids" - expects an array of member identifiers (non-negative integers)
"title" - expects a string
"message" - expects a string

Response Data
An unsigned integer representing the newly created conversation's identifier.
Replies
List replies to an unread conversation

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/conversations/{id}/replies

Path Parameters
"id" - expects a conversation identifier (non-negative integer)

Sortable Fields
"author_id"
"message_date" (default)
"message"

Response Data
An array of Reply objects.
Reply to an unread conversation

Token Type
Private

Method/URL
POST https://gameservershub.com/forums/api/framework/conversations/{id}/replies

Path Parameters
"id" - expects a conversation identifier (non-negative integer)

Body Parameters
"message" - expects a string

Response Data
An unsigned integer representing the newly created reply's identifier.
Members
Retrieve information about yourself

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/self

Response Data
A Member object.
Modify information about yourself

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/members/self

Body Parameters
"custom_title" - expects a string, but is optional
"about_me" - expects a string, but is optional
"signature" - expects a string, but is optional
Retrieve information about a member by ID

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/{id}

Path Parameters
"id" - expects a non-negative integer

Response Data
A Member object.
Retrieve information about a member by username

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/usernames/{name}

Path Parameters
"name" - expects a string

Response Data
A Member object.
Retrieve information about a member by Discord identifier

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/discords/{discord_id}

Path Parameters
"discord_id" - expects a non-negative integer

Response Data
A Member object.
List recently issued bans

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/bans

Response Data
An array of Ban objects.
Profile Posts
List profile posts on your profile

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/self/profile-posts

Sortable Fields
"author_id"
"post_date" (default)
"message"
"comment_count"

Response Data
An array of ProfilePost objects.
Retrieve a specific profile post on your profile

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/members/self/profile-posts/{id}

Path Parameters
"id" - expects a non-negative integer

Response Data
A ProfilePost object.
Edit a specific profile post you've authored on your profile

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/members/self/profile-posts/{id}

Path Parameters
"id" - expects a non-negative integer

Body Parameters
"message" - expects a string
Delete a specific profile post you've authored on your profile

Token Type
Private

Method/URL
DELETE https://gameservershub.com/forums/api/framework/members/self/profile-posts/{id}

Path Parameters
"id" - expects a non-negative integer
Resources
List public resources

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources

Sortable Fields
"last_update_date" (default)
"submission_date"
"title"
"downloads"
"rating"
"purchase_count"
"price"

Response Data
An array of BasicResource objects.
List owned resources

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/owned

Sortable Fields
"last_update_date" (default)
"submission_date"
"title"
"downloads"
"rating"
"purchase_count"
"price"

Response Data
An array of BasicResource objects.
List collaborated resources

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/collaborated

Sortable Fields
"last_update_date" (default)
"submission_date"
"title"
"downloads"
"rating"
"purchase_count"
"price"

Response Data
An array of BasicResource objects.
List resources by author

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/authors/{id}

Path Parameters
"id" - a string representing the resource author's identifier

Sortable Fields
"last_update_date" (default)
"submission_date"
"title"
"downloads"
"rating"
"purchase_count"
"price"

Response Data
An array of BasicResource objects.
Retrieve data about a resource

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}

Path Parameters
"id" - a string representing the resource's identifier

Response Data
A Resource object.
Modify a resource

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/resources/{id}

Path Parameters
"id" - a string representing the resource's identifier

Body Parameters
"title" - expects a string
"tag_line" - expects a string
"description" - expects a string
Versions
List resource versions

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/versions

Path Parameters
"id" - a non-negative integer representing the resource's identifier

Sortable Fields
"release_date" (default)
"name"
"download_count"

Response Data
An array of Version objects.
Retrieve the latest resource version

Token Type
Private & Shared

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/versions/latest

Path Parameters
"id" - a non-negative integer representing the resource's identifier

Response Data
A Version object.
Retrieve a specific resource version

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/versions/{v_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"v_id" - a non-negative integer representing the version's identifier

Response Data
A Version object.
Delete a version

Token Type
Private

Method/URL
DELETE https://gameservershub.com/forums/api/framework/resources/{r_id}/versions/{v_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"v_id" - a non-negative integer representing the version's identifier
Updates
List resource updates

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/updates

Path Parameters
"id" - a non-negative integer representing the resource's identifier

Sortable Fields
"update_date" (default)
"title"
"message"

Response Data
An array of Update objects.
Retrieve the latest update

Token Type
Private & Shared

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/updates/latest

Path Parameters
"id" - a non-negative integer representing the resource's identifier

Response Data
An Update object.
Retrieve an update

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/updates/{u_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"u_id" - a non-negative integer representing the update's identifier

Response Data
An Update object.
Delete an update

Token Type
Private

Method/URL
DELETE https://gameservershub.com/forums/api/framework/resources/{r_id}/updates/{u_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"u_id" - a non-negative integer representing the update's identifier
Reviews
List resource reviews

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/reviews

Path Parameters
"id" - expects a non-negative integer representing the resource's identifier

Sortable Fields
"review_date" (default)
"reviewer_id"
"rating"
"message"
"response"

Response Data
An array of Review objects.
Retrieve a member's resource review

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/reviews/members/{m_id}

Path Parameters
"r_id" - expects a non-negative integer representing the resource's identifier
"m_id" - expects a non-negative integer representing the review's identifier

Response Data
A Review object.
Respond to a resource review

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/resources/{res_id}/reviews/{rev_id}

Path Parameters
"res_id" - expects a non-negative integer representing the resource's identifier
"rev_id" - expects a non-negative integer representing the review's identifier

Body Parameters
"response" - expects a string
Purchases
List resource purchases

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/purchases

Path Parameters
"id" - expects a non-negative integer representing the resource's identifier

Sortable Fields
"purchase_date" (default)
"validation_date"
"purchase_id"
"purchaser_id"
"license_id"
"renewal"
"status"
"price"
"currency"

Response Data
An array of Purchase objects.
Retrieve a resource purchase

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/purchases/{p_id}

Path Parameters
"r_id" - expects a non-negative integer representing the resource's identifier
"p_id" - expects a non-negative integer representing the purchase's identifier

Response Data
A Purchase object.
Licenses
List resource licenses

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/licenses

Path Parameters
"id" - expects a non-negative integer representing the resource's identifier

Sortable Fields
"start_end" (default)
"end_date"
"previous_end_date"
"license_id"
"purchaser_id"
"validated"
"active"

Response Data
An array of License objects.
Retrieve a resource license

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/licenses/{l_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"l_id" - a non-negative integer representing the license's identifier

Response Data
A License object.
Modify a resource license
When modifying a license to be permanent, only the 'active' optional body parameter should be set.
When modifying a license to be temporary, only the 'start_date' and 'end_date' optional body parameters should be set.

Token Type
Private

Method/URL
PATCH https://gameservershub.com/forums/api/framework/resources/{r_id}/licenses/{l_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"l_id" - a non-negative integer representing the license's identifier

Body Parameters
"permanent" - expects a boolean
"active" - optional, expects a boolean
"start_date" - optional, expects a UNIX timestamp
"end_date" - optional, expects a UNIX timestamp
Retrieve a resource license by member

We expect this endpoint to be used in conjunction with our anti-piracy placeholders to ensure that requests attempting to validate a license for a specific purchaser only succeed when we can be confident the request originated from that specific purchaser, and not another member of our platform.

Thus, when making a request to this endpoint via a Shared token type, we require that the "nonce" and "timestamp" anti-piracy placeholders be included as query parameters. These query parameters are ignored when making a request to this endpoint via a Private token type.

Token Type
Private & Shared

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/licenses/members/{m_id}

Path Parameters
"r_id" - a non-negative integer representing the resource's identifier
"m_id" - a non-negative integer representing the member's identifier

Query Parameters
"nonce" - expects a non-negative integer
"date" - expects a UNIX timestamp

Response Data
A License object.
Downloads
List resource downloads

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{id}/downloads

Path Parameters
"id" - expects a non-negative integer

Sortable Fields
"download_date" (default)
"version_id"
"downloader_id"

Response Data
An array of Download objects.
List resource downloads by member

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/downloads/members/{m_id}

Path Parameters
"r_id" - expects a non-negative integer representing the resource's identifier
"m_id" - expects a non-negative integer representing the member's identifier

Sortable Fields
"download_date" (default)
"version_id"

Response Data
An array of Download objects.
List resource downloads by version

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/resources/{r_id}/downloads/versions/{v_id}

Path Parameters
"r_id" - expects a non-negative integer representing the resource's identifier
"v_id" - expects a non-negative integer representing the version's identifier

Sortable Fields
"download_date" (default)
"downloader_id"

Response Data
An array of Download objects.
Threads
List your own threads

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/threads

Sortable Fields
"title"
"reply_count"
"view_count"
"creation_date" (default)
"last_message_date"
"thread_open"

Response Data
An array of BasicThread objects.
Fetch a thread you've authored

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/threads/{id}

Path Paramteres
"id" - expects a non-negative integer representing the thread's identifier

Response Data
A Thread object.
Replies
List replies to a thread you authored

Token Type
Private

Method/URL
GET https://gameservershub.com/forums/api/framework/threads/{id}/replies

Path Parameter
"id" - expects a non-negative integer

Sortable Fields
"author_id"
"post_date" (default)
"message"

Response Data
An array of Reply objects.
Reply to a thread you authored

Token Type
Private

Method/URL
POST https://gameservershub.com/forums/api/framework/threads/{id}/replies

Path Parameter
"id" - expects a non-negative integer

Body Parameters
"message" - expects a string

Response Data
An unsigned integer representing the newly created reply's identifier.
 
Last edited:
Status
Not open for further replies.
Back
Top