Introduction
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
API Endpoint https://api.websitetoolbox.com
The Website Toolbox REST API allows you to programmatically interact with your forum. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application (though you should never expose your secret API key in any public website's client-side code). JSON is returned by all API responses, including errors.
Note that there’s no need to poll the API for updates or new items. You should use webhooks for that.
Note: API requests are rate limited to 3 requests per second. Requests that exceed this limit will return a 400 Bad Request response. API requests count towards your page view usage.
If you need help or have any suggestions regarding how to improve the API, please let us know.
Authentication
Authenticate your account when using the API by including your secret API key in the HTTP headers of the request. You can manage your API keys in the Integrate -> API section. Your API keys carry many privileges, so be sure to keep them secret! Do not share your secret API keys in publicly accessible areas such GitHub, client-side code, and so forth.
All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.
If you created your forum before our API was launched on May 20, 2018, you'll need to regenerate your API key.
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
Errors
Website Toolbox uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was missing etc.), and codes in the 5xx range indicate an error with Website Toolbox servers (these are rare).
HTTP status code summary
Code | Description |
---|---|
200 | OK -- Everything worked as expected. |
400 | Forbidden, Bad Request -- The request was unacceptable, often due to missing a required parameter or exceeding the limit of 3 API requests per second. |
404 | Not Found -- The requested resource doesn't exist. |
500 | Internal Server Error -- Something went wrong on Website Toolbox's end. (These are rare.) |
Parameter | Description |
---|---|
statusstring | Provide status of error. |
error | |
» paramstring | The parameter the error relates to if the error is parameter-specific. |
» messagestring | A human-readable message providing more details about the error. |
» codestring | A short string related to error. |
Categories
The category object
Parameter | Description |
---|---|
canCreateNewTopicboolean | It indicates whether the logged in user can create a new topic. |
categoryIdinteger | The unique identifier for a category. |
descriptionstring | An arbitrary string which you can attach to a category object. It is displayed alongside the category in the web interface. |
followingstring | Follow category to get notified about new topics and replies. Only specified if the x-api-username header has been provided. |
hasUnreadTopicsboolean | It is a boolean representing if the user has unread topics. Only specified if the x-api-username header has been provided. |
headingstring | This is the name of the category heading. |
isFollowingboolean | A boolean representing whether the category is following by user or not. Only specified if the x-api-username header has been provided. |
isPrivateboolean | It is a boolean representing which indicates whether the user currently has access to the category or not. Only specified if the x-api-username header has been provided. |
lastPostobject | Last post object. |
» subjectstring | The subject of last post. |
» timestampinteger | Time at which the last post was created. Measured in seconds since the Unix epoch. |
» topicIdinteger | The unique identifier for a topic. |
» userIdinteger | The userId of member who created last post. |
» usernamestring | The username of member who created last post. |
linkedstring | The category will not be a real category. Instead it will simply be a link to the URL you provide. |
lockedboolean | Boolean representing whether a category is locked or not. Locked will prevent any new posts from being made in the category. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
parentIdinteger | The categoryId of parent category. |
passwordProtectedboolean | Boolean representing whether a category is password protected or not. It is used to password protect the category so only people with the correct password can enter. |
titlestring | This is the name of the category. It describes the theme of the discussions within the category in a concise manner. |
unlistedboolean | Boolean representing whether a category is unlisted or not. Unlisted will hide it on the category listing on forum. |
unreadTopicCountinteger | Unread topics count. Only specified if the x-api-username header has been provided. |
List categories
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/categories \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/categories", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/categories", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/categories',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/categories', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/categories
Returns a list of categories. The categories are returned sorted by displayorder, minimum displayorder category appearing first.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 to 100, and the default is all categories. |
page | query | integer | optional | Page number of results to return. |
Example responses
200 Response
{
"data" : [
{
"canCreateNewTopic" : "boolean",
"categoryId" : "integer",
"description" : "string",
"following" : "string",
"hasUnreadTopics" : "boolean",
"heading" : "string",
"isFollowing" : "boolean",
"isPrivate" : "boolean",
"lastPost" : {
"subject" : "string",
"timestamp" : "integer",
"topicId" : "integer",
"userId" : "integer",
"username" : "string"
},
"linked" : "string",
"locked" : "boolean",
"object" : "string",
"parentId" : "integer",
"passwordProtected" : "boolean",
"title" : "string",
"unlisted" : "boolean",
"unreadTopicCount" : "integer"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of categories. Each entry in the array is a separate category object. If no more categories are available, the resulting array will be empty. This request should never throw an error.
Create a category
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/categories \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/categories", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/categories", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"description" : "string",
"linked" : "string",
"locked" : "boolean",
"parentId" : "integer",
"password" : "string",
"title" : "string",
"unlisted" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/categories',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/categories', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/categories
Creates a new category object.
Body parameter
{
"description" : "string",
"linked" : "string",
"locked" : "boolean",
"parentId" : "integer",
"password" : "string",
"title" : "string",
"unlisted" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» description | body | string | optional | An arbitrary string which you can attach to a category object. It is displayed alongside the category in the web interface. |
» linked | body | string | optional | The category will not be a real category. Instead it will simply be a link to the URL you provide. |
» locked | body | boolean | optional | Boolean representing whether a category is locked or not. Locked will prevent any new posts from being made in the category. |
» parentId | body | integer | optional | The categoryId of parent category. |
» password | body | string | optional | It is used to password protect the category so only people with the correct password can enter. |
» title | body | string | required | This is the name of the category. It describes the theme of the discussions within the category in a concise manner. |
» unlisted | body | boolean | optional | Boolean representing whether a category is unlisted or not. Unlisted will hide it on the category listing on forum. |
Example responses
200 Response
{
"canCreateNewTopic" : "boolean",
"categoryId" : "integer",
"description" : "string",
"following" : "string",
"heading" : "string",
"isFollowing" : "boolean",
"lastPost" : {
"subject" : "string",
"timestamp" : "integer",
"topicId" : "integer",
"userId" : "integer",
"username" : "string"
},
"linked" : "string",
"locked" : "boolean",
"object" : "string",
"parentId" : "integer",
"passwordProtected" : "boolean",
"title" : "string",
"unlisted" : "boolean"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a category object if the call succeeded. Throws an error if something goes wrong.
Retrieve a category
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/categories/{categoryId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/categories/{categoryId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/categories/{categoryId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/categories/{categoryId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories/{categoryId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/categories/{categoryId}
Retrieves the details of an existing category. You need only supply the unique category identifier that was returned upon category creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
categoryId | path | integer | required | The unique identifier for a category. |
Example responses
200 Response
{
"canCreateNewTopic" : "boolean",
"categoryId" : "integer",
"description" : "string",
"following" : "string",
"heading" : "string",
"isFollowing" : "boolean",
"lastPost" : {
"subject" : "string",
"timestamp" : "integer",
"topicId" : "integer",
"userId" : "integer",
"username" : "string"
},
"linked" : "string",
"locked" : "boolean",
"object" : "string",
"parentId" : "integer",
"passwordProtected" : "boolean",
"title" : "string",
"unlisted" : "boolean"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a category object if a valid identifier was provided.
Update a category
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/categories/{categoryId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/categories/{categoryId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/categories/{categoryId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"description" : "string",
"linked" : "string",
"locked" : "boolean",
"parentId" : "integer",
"password" : "string",
"title" : "string",
"unlisted" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/categories/{categoryId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories/{categoryId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/categories/{categoryId}
Updates the specified category by setting the values of the parameters passed. Any parameters not provided will be left unchanged. This request accepts mostly the same arguments as the category creation call.
Body parameter
{
"description" : "string",
"linked" : "string",
"locked" : "boolean",
"parentId" : "integer",
"password" : "string",
"title" : "string",
"unlisted" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
categoryId | path | integer | required | The unique identifier for a category. |
body | ||||
» description | body | string | optional | An arbitrary string which you can attach to a category object. It is displayed alongside the category in the web interface. |
» linked | body | string | optional | The category will not be a real category. Instead it will simply be a link to the URL you provide. |
» locked | body | boolean | optional | Boolean representing whether a category is locked or not. Locked will prevent any new posts from being made in the category. |
» parentId | body | integer | optional | The categoryId of parent category. |
» password | body | string | optional | The password of category. It is used to password protected category so only people with the correct password can enter. |
» title | body | string | optional | This is the name of the category. It describes the theme of the discussions within the category in a concise manner. |
» unlisted | body | boolean | optional | Boolean representing whether a category is unlisted or not. Unlisted will hide it on the category listing on forum. |
Example responses
200 Response
{
"canCreateNewTopic" : "boolean",
"categoryId" : "integer",
"description" : "string",
"following" : "string",
"heading" : "string",
"isFollowing" : "boolean",
"lastPost" : {
"subject" : "string",
"timestamp" : "integer",
"topicId" : "integer",
"userId" : "integer",
"username" : "string"
},
"linked" : "string",
"locked" : "boolean",
"object" : "string",
"parentId" : "integer",
"passwordProtected" : "boolean",
"title" : "string",
"unlisted" : "boolean"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns the category object if the update succeeded.
Delete a category
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/categories/{categoryId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/categories/{categoryId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/categories/{categoryId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/categories/{categoryId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/categories/{categoryId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories/{categoryId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/categories/{categoryId}
Permanently deletes a category. It cannot be undone. Also immediately deletes any topics and posts on the category.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
categoryId | path | integer | required | The unique identifier for a category. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
List category permissions
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/categories/{categoryId}/permissions", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/categories/{categoryId}/permissions", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/categories/{categoryId}/permissions
Returns a list of all userGroup permissions for a category.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
categoryId | path | integer | required | The unique identifier for a category. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
Example responses
200 Response
{
"data" : [
{
"object" : "string",
"replyTopics" : "boolean",
"requirePostApproval" : "boolean",
"startTopics" : "boolean",
"uploadAttachments" : "boolean",
"userGroupId" : "integer",
"viewAttachments" : "boolean",
"viewCategory" : "boolean",
"viewOthersTopics" : "boolean"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
An array of usergroup permissions. Each entry in the array is a separate usergroup object. If no more permissions are available, the resulting array will be empty. This request should never throw an error.
Update category permissions
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions/{userGroupId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/categories/{categoryId}/permissions/{userGroupId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/categories/{categoryId}/permissions/{userGroupId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"replyTopics" : "boolean",
"requirePostApproval" : "boolean",
"startTopics" : "boolean",
"uploadAttachments" : "boolean",
"viewAttachments" : "boolean",
"viewCategory" : "boolean",
"viewOthersTopics" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions/{userGroupId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions/{userGroupId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions/{userGroupId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/categories/{categoryId}/permissions/{userGroupId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/categories/{categoryId}/permissions/{userGroupId}
Updates the permissions of specified userGroup by setting the values of the permissions passed. Any permissions not provided will be left unchanged.
Body parameter
{
"replyTopics" : "boolean",
"requirePostApproval" : "boolean",
"startTopics" : "boolean",
"uploadAttachments" : "boolean",
"viewAttachments" : "boolean",
"viewCategory" : "boolean",
"viewOthersTopics" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
categoryId | path | integer | required | The unique identifier for a category. |
userGroupId | path | integer | required | Unique identifier for the user group object. |
body | ||||
» replyTopics | body | boolean | optional | Boolean representing whether replyTopics permission is enabled or not. |
» requirePostApproval | body | boolean | optional | Boolean representing whether requirePostApproval permission is enabled or not. |
» startTopics | body | boolean | optional | Boolean representing whether startTopics permission is enabled or not. |
» uploadAttachments | body | boolean | optional | Boolean representing whether uploadAttachments permission is enabled or not. |
» viewAttachments | body | boolean | optional | Boolean representing whether viewAttachments permission is enabled or not. |
» viewCategory | body | boolean | optional | Boolean representing whether viewCategory permission is enabled or not. |
» viewOthersTopics | body | boolean | optional | Boolean representing whether viewOthersTopics permission is enabled or not. |
Example responses
200 Response
{
"replyTopics" : "boolean",
"requirePostApproval" : "boolean",
"startTopics" : "boolean",
"uploadAttachments" : "boolean",
"viewAttachments" : "boolean",
"viewCategory" : "boolean",
"viewOthersTopics" : "boolean"
}
Returns
Returns the userGroup object if the update succeeded.
Moderators
The moderator object
Parameter | Description |
---|---|
addPollsboolean | Boolean representing whether addPolls permission is enabled or not. |
approvePostsboolean | Boolean representing whether approvePosts permission is enabled or not. |
categoryIdinteger | The categoryId to which moderator is assigned |
deletePollsboolean | Boolean representing whether deletePolls permission is enabled or not. |
deletePostsboolean | Boolean representing whether deletePosts permission is enabled or not. |
editPollsboolean | Boolean representing whether editPolls permission is enabled or not. |
editPostsboolean | Boolean representing whether editPosts permission is enabled or not. |
lockTopicsboolean | Boolean representing whether lockTopics permission is enabled or not. |
moderatorIdinteger | The unique identifier for a moderator. |
movePostsboolean | Boolean representing whether movePosts permission is enabled or not. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
pinTopicsboolean | Boolean representing whether pinTopics permission is enabled or not. |
userIdinteger | The unique identifier of member that belongs to this object. |
usernamestring | The username of moderator. |
List moderators
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/category_moderators \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/category_moderators", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/category_moderators", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/category_moderators',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/category_moderators',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/category_moderators', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/category_moderators");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/category_moderators
Returns a list of all moderators for all categories.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
categoryId | query | integer | optional | Category Id to filter out the results. |
Example responses
200 Response
{
"data" : [
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryId" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"moderatorId" : "integer",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer",
"username" : "string"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of moderators. Each entry in the array is a separate moderator object. If no more moderators are available, the resulting array will be empty. This request should never throw an error.
Create a moderator
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/category_moderators \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/category_moderators", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/category_moderators", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryIds" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/category_moderators',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/category_moderators',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/category_moderators', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/category_moderators");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/category_moderators
Creates a new moderator object.
Body parameter
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryIds" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» addPolls | body | boolean | optional | Boolean representing whether addPolls permission is enabled or not. |
» approvePosts | body | boolean | optional | Boolean representing whether approvePosts permission is enabled or not. |
» categoryIds | body | integer | required | The categoryIds for which moderator has to be assigned. |
» deletePolls | body | boolean | optional | Boolean representing whether deletePolls permission is enabled or not. |
» deletePosts | body | boolean | optional | Boolean representing whether deletePosts permission is enabled or not. |
» editPolls | body | boolean | optional | Boolean representing whether editPolls permission is enabled or not. |
» editPosts | body | boolean | optional | Boolean representing whether editPosts permission is enabled or not. |
» lockTopics | body | boolean | optional | Boolean representing whether lockTopics permission is enabled or not. |
» movePosts | body | boolean | optional | Boolean representing whether movePosts permission is enabled or not. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» pinTopics | body | boolean | optional | Boolean representing whether pinTopics permission is enabled or not. |
» userId | body | integer | required | The unique identifier of member that needs to assign a moderator. |
Example responses
200 Response
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryId" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"moderatorId" : "string",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer",
"username" : "string"
}
Returns
Returns an array of moderator objects if the call succeeded. Throws an error if something goes wrong.
Retrieve a moderator
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/category_moderators/{moderatorId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/category_moderators/{moderatorId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/category_moderators/{moderatorId}
Retrieves the details of an existing moderator. You need only supply the unique moderator identifier that was returned upon moderator creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
moderatorId | path | integer | required | The unique identifier for a moderator. |
Example responses
200 Response
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryId" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"moderatorId" : "string",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer",
"username" : "string"
}
Returns
Returns a moderator object if a valid identifier was provided.
Update a moderator
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/category_moderators/{moderatorId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/category_moderators/{moderatorId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"addPolls" : "boolean",
"approvePosts" : "boolean",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"movePosts" : "boolean",
"pinTopics" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/category_moderators/{moderatorId}
Updates the specified moderator by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Body parameter
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"movePosts" : "boolean",
"pinTopics" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
moderatorId | path | integer | required | The unique identifier for a moderator. |
body | ||||
» addPolls | body | boolean | optional | Boolean representing whether addPolls permission is enabled or not. |
» approvePosts | body | boolean | optional | Boolean representing whether approvePosts permission is enabled or not. |
» deletePolls | body | boolean | optional | Boolean representing whether deletePolls permission is enabled or not. |
» deletePosts | body | boolean | optional | Boolean representing whether deletePosts permission is enabled or not. |
» editPolls | body | boolean | optional | Boolean representing whether editPolls permission is enabled or not. |
» editPosts | body | boolean | optional | Boolean representing whether editPosts permission is enabled or not. |
» lockTopics | body | boolean | optional | Boolean representing whether lockTopics permission is enabled or not. |
» movePosts | body | boolean | optional | Boolean representing whether movePosts permission is enabled or not. |
» pinTopics | body | boolean | optional | Boolean representing whether pinTopics permission is enabled or not. |
Example responses
200 Response
{
"addPolls" : "boolean",
"approvePosts" : "boolean",
"categoryId" : "integer",
"deletePolls" : "boolean",
"deletePosts" : "boolean",
"editPolls" : "boolean",
"editPosts" : "boolean",
"lockTopics" : "boolean",
"moderatorId" : "string",
"movePosts" : "boolean",
"object" : "string",
"pinTopics" : "boolean",
"userId" : "integer",
"username" : "string"
}
Returns
Returns the moderator object if the update succeeded.
Delete a moderator
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/category_moderators/{moderatorId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/category_moderators/{moderatorId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/category_moderators/{moderatorId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/category_moderators/{moderatorId}
Permanently deletes a moderator. It cannot be undone.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
moderatorId | path | integer | required | The unique identifier for a moderator. |
Example responses
200 Response
{
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Conversations
The conversation object
Parameter | Description |
---|---|
conversationIdinteger | The unique identifier for a conversation. |
dateTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
participantsarray | The list of members who participate in conversation. |
» activeboolean | Boolean representing whether a participant is active or not. |
» conversationIdinteger | The unique identifier for a conversation. |
» conversationUserIdinteger | The unique identifier for a conversation userId. |
» isStarterboolean | Boolean representing whether a participant is started the conversation or not. |
» isUnreadboolean | Boolean representing whether a conversation is unread or not. |
» leftTimestampinteger | Time at which the object was left. Measured in seconds since the Unix epoch. |
» readTimestampinteger | Time at which the object was read. Measured in seconds since the Unix epoch. |
» unreadCountinteger | The number of unread messages in conversation. |
» userobject | Participant's user object. |
» userIdinteger | Participant's userId. |
subjectstring | Thing that is being discussed, described for conversation. |
List conversations
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/conversations \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/conversations", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/conversations", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/conversations',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/conversations', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/conversations
Returns a list of conversations. The conversations are returned sorted by creation date, with the most recent conversations appearing first.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | query | integer | optional | The unique identifier of member to filter out the results. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
folder | query | string | optional | Potential values are "inbox" or "archive". |
Example responses
200 Response
{
"data" : [
{
"conversationId" : "integer",
"dateTimestamp" : "integer",
"object" : "string",
"participants" : [
{
"active" : "boolean",
"conversationId" : "integer",
"conversationUserId" : "integer",
"isStarter" : "boolean",
"isUnread" : "boolean",
"leftTimestamp" : "integer",
"readTimestamp" : "integer",
"unreadCount" : "integer",
"user" : "object",
"userId" : "integer"
}
],
"subject" : "string"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of up to limit conversations. Each entry in the array is a separate conversation object. If no more conversations are available, the resulting array will be empty. This request should never throw an error.
Create a conversation
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/conversations \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/conversations", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/conversations", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"message" : "string",
"recipientUsernames" : [
"string array"
],
"senderId" : "integer",
"subject" : "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/conversations',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/conversations', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/conversations
Creates a new conversation object.
Body parameter
{
"message" : "string",
"recipientUsernames" : [
"string array"
],
"senderId" : "integer",
"subject" : "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» message | body | string | optional | Message is usually a content, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
» recipientUsernames | body | [string array] | optional | A list of usernames who will receive the messages. |
» senderId | body | integer | optional | Sender's userId who started the conversation. |
» subject | body | string | optional | Thing that is being discussed, described for conversation. |
Example responses
200 Response
{
"conversationId" : "integer",
"dateTimestamp" : "integer",
"object" : "string",
"participants" : [
{
"active" : "boolean",
"conversationId" : "integer",
"conversationUserId" : "integer",
"isStarter" : "boolean",
"isUnread" : "boolean",
"leftTimestamp" : "integer",
"readTimestamp" : "integer",
"unreadCount" : "integer",
"user" : "object",
"userId" : "integer"
}
],
"subject" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a conversation object if the call succeeded. Throws an error if something goes wrong.
Retrieve a conversation
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/conversations/{conversationId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/conversations/{conversationId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/conversations/{conversationId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/conversations/{conversationId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations/{conversationId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/conversations/{conversationId}
Retrieves the details of an existing conversation. You need only supply the unique conversation identifier that was returned upon conversation creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
conversationId | path | integer | required | The unique identifier of conversation to filter out the results. |
Example responses
200 Response
{
"conversationId" : "integer",
"dateTimestamp" : "integer",
"object" : "string",
"participants" : [
{
"active" : "boolean",
"conversationId" : "integer",
"conversationUserId" : "integer",
"isStarter" : "boolean",
"isUnread" : "boolean",
"leftTimestamp" : "integer",
"readTimestamp" : "integer",
"unreadCount" : "integer",
"user" : "object",
"userId" : "integer"
}
],
"subject" : "string"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a conversation object if a valid identifier was provided.
Delete a conversation
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/conversations/{conversationId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/conversations/{conversationId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/conversations/{conversationId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/conversations/{conversationId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations/{conversationId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/conversations/{conversationId}
Permanently deletes a customer. It cannot be undone.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
conversationId | path | integer | required | The unique identifier of conversation to filter out the results. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Messages
The message object
Parameter | Description |
---|---|
attachmentsarray | Attachment list associated with message. |
» URLstring | The attachment URL. |
» descriptionstring | The description of attachment. |
» downloadsinteger | The number of downloads. |
» fileNamestring | The file name of attachment. |
» fileSizeinteger | File size of attachment. |
» idinteger | The unique identifier for a attachment. |
» objectstring | String representing the object’s type. Objects of the same type share the same value. |
» thumbnailURLstring | The attachment thumbnail URL. |
» uploadTimestampinteger | Upload timestamp of attachment. |
» userIdinteger | The userId of user who upoloaded the attachment. |
dateTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
isUnreadboolean | Boolean representing whether a message is unread or not. |
messagestring | Message is usually a content, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
messageIdinteger | The unique identifier for a message. |
messageTextstring | messageText is the text version of the message with all HTML removed. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
previewstring | preview is a short text version of the message. |
senderobject | The member who created this object. |
» userIdinteger | The userId of member who created this object. |
» usernamestring | The username of member who created this object. |
List messages
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/conversations/{conversationId}/messages", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/conversations/{conversationId}/messages", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/conversations/{conversationId}/messages
Returns a list of your messages for a conversation. The messages are returned sorted by creation date, with the most recent messages appearing first.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | query | integer | optional | The unique identifier of member to filter out the results. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
conversationId | path | integer | required | The unique identifier of conversation to filter out the results. |
page | query | integer | optional | Page number of results to return. |
includeId | query | integer | optional | When this parameter is provided, the API will return the page that includes the object with the ID specified in includeId. |
Example responses
200 Response
{
"data" : [
{
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"dateTimestamp" : "integer",
"isUnread" : "boolean",
"message" : "string",
"messageId" : "integer",
"messageText" : "string",
"object" : "string",
"preview" : "string",
"sender" : {
"userId" : "integer",
"username" : "string"
}
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
An array of up to limit messages. Each entry in the array is a separate message object. If no more messages are available, the resulting array will be empty. This request should never throw an error.
Create a message
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/conversations/{conversationId}/messages", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/conversations/{conversationId}/messages", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"message" : "string",
"userId" : "integer"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/conversations/{conversationId}/messages
Creates a new message object for conversation.
Body parameter
{
"message" : "string",
"userId" : "integer"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
conversationId | path | integer | required | The unique identifier of conversation to filter out the results. |
body | ||||
» message | body | string | optional | Message is usually a content, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
» userId | body | integer | optional | The userId of member to create a message. |
Example responses
200 Response
{
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"dateTimestamp" : "integer",
"isUnread" : "boolean",
"message" : "string",
"messageId" : "integer",
"messageText" : "string",
"object" : "string",
"preview" : "string",
"sender" : {
"userId" : "integer",
"username" : "string"
}
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a message object if the call succeeded. Throws an error if something goes wrong.
Retrieve a message
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages/{messageId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/conversations/{conversationId}/messages/{messageId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/conversations/{conversationId}/messages/{messageId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages/{messageId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages/{messageId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages/{messageId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/conversations/{conversationId}/messages/{messageId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/conversations/{conversationId}/messages/{messageId}
Retrieves the details of an existing message. You need only supply the unique message identifier that was returned upon message creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | query | integer | optional | The unique identifier of member to filter out the results. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
messageId | path | integer | required | The unique identifier of message to filter out the results. |
conversationId | path | integer | required | The unique identifier of conversation to filter out the results. |
page | query | integer | optional | Page number of results to return. |
includeId | query | integer | optional | When this parameter is provided, the API will return the page that includes the object with the ID specified in includeId. |
Example responses
200 Response
{
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"dateTimestamp" : "integer",
"isUnread" : "boolean",
"message" : "string",
"messageId" : "integer",
"messageText" : "string",
"object" : "string",
"preview" : "string",
"sender" : {
"userId" : "integer",
"username" : "string"
}
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a message object if a valid identifiers were provided.
Page Views
The page view object
Parameter | Description |
---|---|
URIstring | URI of the page view. |
apiRequestboolean | API Request. |
crawlerobject | Crawler is a generic term for any program that is used to automatically discover and scan websites. |
» URLstring | The URL of the crawler. |
» namestring | Name of the Crawler. |
dateTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
ipAddressinteger | IP address of the member. |
newVisitboolean | It specify whether this was a new session started by a member or a guest. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
pageViewIdinteger | The unique identifier for the page view. |
titlestring | Title of the page view. |
userAgentstring | User Agent of the page view. |
userIdstring | UserId of the member who access the page. |
List Page Views
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/page_views \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/page_views", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/page_views", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/page_views',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/page_views',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/page_views', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/page_views");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/page_views
Returns a list of page views. Page views are added in real-time and reset hourly
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
Example responses
200 Response
{
"data" : [
{
"URI" : "string",
"apiRequest" : "boolean",
"crawler" : {
"URL" : "string",
"name" : "string"
},
"dateTimestamp" : "integer",
"ipAddress" : "integer",
"newVisit" : "boolean",
"object" : "string",
"pageViewId" : "integer",
"title" : "string",
"userAgent" : "string",
"userId" : "string"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of up to limit page views. Each entry in the array is a separate page view object. If no more page view objects are available, the resulting array will be empty. This request should never throw an error.
Posts
The post object
Parameter | Description |
---|---|
attachmentCountinteger | Total number of attachments in post. |
attachmentsarray | Attachment list associated with post. |
» URLstring | The attachment URL. |
» descriptionstring | The description of attachment. |
» downloadsinteger | The number of downloads. |
» fileNamestring | The file name of attachment. |
» fileSizeinteger | File size of attachment. |
» idinteger | The unique identifier for a attachment. |
» objectstring | String representing the object’s type. Objects of the same type share the same value. |
» thumbnailURLstring | The attachment thumbnail URL. |
» uploadTimestampinteger | Upload timestamp of attachment. |
» userIdinteger | The userId of user who upoloaded the attachment. |
authorobject | The author of post. |
» avatarUrlstring | The URL of an icon or image representing a particular member in forum who created this object. |
» userIdinteger | The userId of member who created this object. |
» usernamestring | The username of member who created this object. |
canDeleteboolean | A boolean representing whether the logged in user can perform delete action on the post. Only specified if the x-api-username header has been provided. |
canEditboolean | A boolean representing whether the logged in user can perform edit action on the post. Only specified if the x-api-username header has been provided. |
dislikeCountinteger | Total number of post dislikes. |
editTimestampinteger | Time at which the object was edited. Measured in seconds since the Unix epoch.(Read Only) |
likeCountinteger | Total number of post likes. |
messagestring | Message is usually a content, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
messageTextstring | messageText is the text version of the message with all HTML removed. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
pendingboolean | Boolean representing whether a post is pending or not. Pending post will only be displayed after approval of moderator. |
postIdinteger | The unique identifier of post |
postTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
previewstring | preview is a short text version of the message. |
topicIdinteger | The unique identifier of topic. |
voteobject | The vote object. |
» dateTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
» objectstring | String representing the object’s type. Objects of the same type share the same value. |
» postIdinteger | The unique identifier of post. |
» postVoteIdinteger | The unique identifier of postVote. |
» userIdinteger | The userId of member who created this object. |
» voteinteger | If that's 1, the user has liked the post. If that's 0, the user has disliked the post. If there is no "vote" attribute in the post object, the user has not liked or disliked the post. |
List posts
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/posts \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/posts", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/posts", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/posts',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/posts',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/posts', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/posts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/posts
Returns a list of posts. The posts are returned sorted by creation date, with the most recent posts appearing first. When the postId parameter is specified, you can sort by postId to have the posts ordered in the order the IDs were specified.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
postId | query | integer array | optional | Post Ids to filter out the results. When the postId parameter is specified, you can sort by postId to have the posts ordered in the order the IDs were specified. |
categoryId | query | integer | optional | Category Ids to filter out the results. |
expand | query | string | optional | It will provide category and topic object in response. Possible values are 'topic' and 'category'. |
userId | query | integer array | optional | User Ids to filter out the results. |
topicId | query | integer array | optional | Topic Ids to filter out the results. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
sort | query | string | optional | To sort out the results. |
order | query | string | optional | Order of Posts. It supports values of either asc or desc for ascending or descending order. Desc is the default. |
page | query | integer | optional | Page number of results to return. |
includeId | query | integer | optional | When this parameter is provided, the API will return the page that includes the object with the ID specified in includeId. |
Example responses
200 Response
{
"data" : [
{
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer",
"vote" : {
"dateTimestamp" : "integer",
"object" : "string",
"postId" : "integer",
"postVoteId" : "integer",
"userId" : "integer",
"vote" : "integer"
}
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of up to limit posts. Each entry in the array is a separate post object. If no more posts are available, the resulting array will be empty. This request should never throw an error.
Create a post
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/posts \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/posts", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/posts", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"content" : "string",
"topicId" : "integer",
"username" : "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/posts',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/posts',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/posts', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/posts");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/posts
Creates a new post object.
Body parameter
{
"content" : "string",
"topicId" : "integer",
"username" : "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» content | body | string | required | Content is usually a message, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
» topicId | body | integer | required | The unique identifier of topic to create this object. |
» username | body | string | required | The username of member to create this object. |
Example responses
200 Response
{
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a post object if the call succeeded. Throws an error if something goes wrong.
Retrieve a post
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/posts/{postId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/posts/{postId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/posts/{postId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/posts/{postId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/posts/{postId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/posts/{postId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/posts/{postId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/posts/{postId}
Retrieves the details of an existing post. You need only supply the unique post identifier that was returned upon post creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
postId | path | integer | required | Unique identifier for the post object. |
expand | query | string | optional | It will provide category and topic object in response. Possible values are 'topic' and 'category'. |
Example responses
200 Response
{
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a post object if a valid identifier was provided.
Update a post
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/posts/{postId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/posts/{postId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/posts/{postId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/posts/{postId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/posts/{postId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/posts/{postId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/posts/{postId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/posts/{postId}
Updates the specified post by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
Body parameter
{
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
postId | path | integer | required | Unique identifier for the post object. |
body | ||||
» attachmentCount | body | integer | optional | Total number of attachments in post. |
» attachments | body | array | optional | Attachment list associated with post. |
» URL | body | string | optional | The attachment URL. |
» description | body | string | optional | The description of attachment. |
» downloads | body | integer | optional | The number of downloads. |
» fileName | body | string | optional | The file name of attachment. |
» fileSize | body | integer | optional | File size of attachment. |
» id | body | integer | optional | The unique identifier for a attachment. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» thumbnailURL | body | string | optional | The attachment thumbnail URL. |
» uploadTimestamp | body | integer | optional | Upload timestamp of attachment. |
» userId | body | integer | optional | The userId of user who upoloaded the attachment. |
» author | body | object | optional | The member who created this object. |
» canDelete | body | boolean | optional | A boolean representing whether the logged in user can perform delete action on the post. Only specified if the x-api-username header has been provided. |
» canEdit | body | boolean | optional | A boolean representing whether the logged in user can perform edit action on the post. Only specified if the x-api-username header has been provided. |
» dislikeCount | body | integer | optional | Total number of post dislikes. |
» editTimestamp | body | integer | optional | Time at which the object was edited. Measured in seconds since the Unix epoch.(Read Only) |
» likeCount | body | integer | optional | Total number of post likes. |
» message | body | string | optional | Message is usually a content, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
» messageText | body | string | optional | messageText is the text version of the message with all HTML removed. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» pending | body | boolean | optional | Boolean representing whether a post is pending or not. Pending post will only be displayed after approval of moderator. |
» postId | body | integer | optional | The unique identifier of post |
» postTimestamp | body | integer | optional | Time at which the object was created. Measured in seconds since the Unix epoch. |
» preview | body | string | optional | preview is a short text version of the message. |
» topicId | body | integer | optional | The unique identifier of topic. |
Example responses
200 Response
{
"attachmentCount" : "integer",
"attachments" : [
{
"URL" : "string",
"description" : "string",
"downloads" : "integer",
"fileName" : "string",
"fileSize" : "integer",
"id" : "integer",
"object" : "string",
"thumbnailURL" : "string",
"uploadTimestamp" : "integer",
"userId" : "integer"
}
],
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canDelete" : "boolean",
"canEdit" : "boolean",
"dislikeCount" : "integer",
"editTimestamp" : "integer",
"likeCount" : "integer",
"message" : "string",
"messageText" : "string",
"object" : "string",
"pending" : "boolean",
"postId" : "integer",
"postTimestamp" : "integer",
"preview" : "string",
"topicId" : "integer"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns the post object if the update succeeded.
Delete a post
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/posts/{postId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/posts/{postId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/posts/{postId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/posts/{postId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/posts/{postId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/posts/{postId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/posts/{postId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/posts/{postId}
Permanently deletes a post. It cannot be undone. Also immediately deletes any attachments on the post.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
postId | path | integer | required | Unique identifier for the post object. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Tags
The tag object
Parameter | Description |
---|---|
objectstring | String representing the object’s type. Objects of the same type share the same value. |
tagIdinteger | The unique identifier for a tag. |
tagNamestring | This is the name of the tag. |
List tags
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/tags \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/tags", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/tags", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/tags',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/tags',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/tags', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/tags");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/tags
Returns a list of tags.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
Example responses
200 Response
{
"data" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of tags. Each entry in the array is a separate tag object. If no more tags are available, the resulting array will be empty. This request should never throw an error.
Topics
The topic object
Parameter | Description |
---|---|
authorobject | The member who created this object. |
» userIdinteger | The userId of member who created this object. |
» usernamestring | The username of member who created this object. |
canReplyboolean | It indicates whether the logged in user can reply to the topic. Only specified if the x-api-username header has been provided. |
categoryIdinteger | The unique identifier of category that belongs to this object. |
dateTimestampinteger | Time at which the object was created. Measured in seconds since the Unix epoch. |
firstPostIdinteger | The unique identifier of first post in topic. |
firstUnreadPostobject | A post object. The first unread post for the user. Only specified if the x-api-username header has been provided. |
hasUnreadPostsboolean | A boolean representing whether the topic contains posts that haven't been read by the user. Only specified if the x-api-username header has been provided. |
lastPostobject | Last post of object. |
» userIdinteger | The userId of member who created last post. |
» usernamestring | The username of member who created last post. |
» postIdinteger | The unique identifier for a post. |
» timestampinteger | Time at which the last post was created. Measured in seconds since the Unix epoch. |
lockedboolean | Boolean representing whether a topic is locked or not. Locked will prevent any new posts from being made in the topic. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
pinnedboolean | Boolean representing whether a topic is pinned or not. Pinned topic display at the beginning of that forum's topic listing to ensure that it receives attention from forum users. |
pollIdinteger | The unique identifier for a poll. |
postCountinteger | The number of posts in topic. |
replyCountinteger | The number of replies in topic. |
tagsarray | An array of topic tags. |
» objectstring | String representing the object’s type. Objects of the same type share the same value. |
» tagIdinteger | The unique identifier for a tag. |
» tagNamestring | This is the name of the tag. |
titlestring | Thing that is being discussed, described for topic. |
topicIdinteger | The unique identifier for a topic. |
viewCountinteger | The number of views in topic. |
List topics
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/topics \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/topics", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/topics", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/topics',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/topics',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/topics', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/topics");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/topics
Returns a list of topics. The topics are returned sorted by creation date, with the most recent topics appearing first. When the topicId parameter is specified, you can sort by topicId to have the topics ordered in the order the IDs were specified.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | query | integer array | optional | User Ids to filter out the results. |
topicId | query | integer array | optional | Topic Ids to filter out the results. When the topicId parameter is specified, you can sort by topicId to have the topics ordered in the order the IDs were specified. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
sort | query | string | optional | To sort out the results. Possible values are top, latest, new or views. |
categoryId | query | integer array | optional | Category Ids to filter out the results. |
page | query | integer | optional | Page number of results to return. |
period | query | string | optional | To filter out the results for the "top" sort method. Possible values are all, year, quarter, month, week or today. |
expand | query | string | optional | It will provide requested object information in response. Possible values are 'category' and 'poll'. |
Example responses
200 Response
{
"data" : [
{
"author" : {
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"firstUnreadPost" : "object",
"hasUnreadPosts" : "boolean",
"lastPost" : {
"author" : {
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of up to limit topics. Each entry in the array is a separate topic object. If no more topics are available, the resulting array will be empty. This request should never throw an error.
Create a topic
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/topics \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/topics", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/topics", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"categoryId" : "integer",
"content" : "string",
"title" : "string",
"username" : "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/topics',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/topics',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/topics', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/topics");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/topics
Creates a new topic object.
Body parameter
{
"categoryId" : "integer",
"content" : "string",
"title" : "string",
"username" : "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» categoryId | body | integer | optional | The unique identifier of category to create this object. |
» content | body | string | required | Content is usually a message, and its purpose is either to ask a question, answer a question or to contributes towards the forum discussion by expressing an opinion or bringing forth information. |
» title | body | string | required | Thing that is being discussed, described for topic. |
» username | body | string | required | The username of member to create this object. |
Example responses
200 Response
{
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"isFollowing" : "boolean",
"lastPost" : {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a topic object if the call succeeded. Throws an error if something goes wrong.
Retrieve a topic
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/topics/{topicId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/topics/{topicId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/topics/{topicId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/topics/{topicId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/topics/{topicId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/topics/{topicId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/topics/{topicId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/topics/{topicId}
Retrieves the details of an existing topic. You need only supply the unique topic identifier that was returned upon topic creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
topicId | path | integer | required | Unique identifier for the topic object. |
expand | query | string | optional | It will provide requested object information in response. Possible values are 'category' and 'poll'. |
Example responses
200 Response
{
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"isFollowing" : "boolean",
"lastPost" : {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a topic object if a valid identifier was provided.
Update a topic
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/topics/{topicId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/topics/{topicId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/topics/{topicId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"isFollowing" : "boolean",
"lastPost" : {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/topics/{topicId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/topics/{topicId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/topics/{topicId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/topics/{topicId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/topics/{topicId}
Updates the specified topic by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request accepts mostly the same arguments as the topic creation call.
Body parameter
{
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"isFollowing" : "boolean",
"lastPost" : {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
topicId | path | integer | required | Unique identifier for the topic object. |
body | ||||
» author | body | object | optional | The member who created this object. |
» canReply | body | boolean | optional | It indicates whether the logged in user can reply to the topic. Only specified if the x-api-username header has been provided. |
» categoryId | body | integer | optional | The unique identifier of category that belongs to this object. |
» dateTimestamp | body | integer | optional | Time at which the object was created. Measured in seconds since the Unix epoch. |
» firstPostId | body | integer | optional | The unique identifier of first post in topic. |
» isFollowing | body | boolean | optional | A boolean representing whether the topic is following by user or not. Only specified if the x-api-username header has been provided. |
» lastPost | body | object | optional | Last post of object. |
» locked | body | boolean | optional | Boolean representing whether a topic is locked or not. Locked will prevent any new posts from being made in the topic. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» pinned | body | boolean | optional | Boolean representing whether a topic is pinned or not. Pinned topic display at the beginning of that forum's topic listing to ensure that it receives attention from forum users. |
» pollId | body | integer | optional | The unique identifier for a poll. |
» postCount | body | integer | optional | The number of posts in topic. |
» replyCount | body | integer | optional | The number of replies in topic. |
» tags | body | array | optional | A list of topic tags. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» tagId | body | integer | optional | The unique identifier for a tag. |
» tagName | body | string | optional | This is the name of the tag. |
» title | body | string | optional | Thing that is being discussed, described for topic. |
» topicId | body | integer | optional | The unique identifier for a topic. |
» viewCount | body | integer | optional | The number of views in topic. |
Example responses
200 Response
{
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"canReply" : "boolean",
"categoryId" : "integer",
"dateTimestamp" : "integer",
"firstPostId" : "integer",
"isFollowing" : "boolean",
"lastPost" : {
"author" : {
"avatarUrl" : "string",
"userId" : "integer",
"username" : "string"
},
"postId" : "integer",
"timestamp" : "integer"
},
"locked" : "boolean",
"object" : "string",
"pinned" : "boolean",
"pollId" : "integer",
"postCount" : "integer",
"replyCount" : "integer",
"tags" : [
{
"object" : "string",
"tagId" : "integer",
"tagName" : "string"
}
],
"title" : "string",
"topicId" : "integer",
"viewCount" : "integer"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns the topic object if the update succeeded.
Delete a topic
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/topics/{topicId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/topics/{topicId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/topics/{topicId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/topics/{topicId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/topics/{topicId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/topics/{topicId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/topics/{topicId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/topics/{topicId}
Permanently deletes a topic. It cannot be undone. Also immediately deletes all posts in the topic.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
topicId | path | integer | required | Unique identifier for the topic object. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
User groups
The user group object
Parameter | Description |
---|---|
changeUsernameboolean | Boolean representing whether changeUsername permission is enabled or not. |
createAlbumsboolean | Boolean representing whether createAlbums permission is enabled or not. |
customTitleboolean | Boolean representing whether customTitle permission is enabled or not. |
defaultGroupboolean | Boolean representing whether defaultGroup permission is enabled or not. |
deleteOwnEventsboolean | Boolean representing whether deleteOwnEvents permission is enabled or not. |
deleteOwnImagesboolean | Boolean representing whether deleteOwnImages permission is enabled or not. |
deleteOwnPostsboolean | Boolean representing whether deleteOwnPosts permission is enabled or not. |
deleteOwnProfileboolean | Boolean representing whether deleteOwnProfile permission is enabled or not. |
deleteOwnTopicsboolean | Boolean representing whether deleteOwnTopics permission is enabled or not. |
downloadFilesboolean | Boolean representing whether downloadFiles permission is enabled or not. |
editOwnEventsboolean | Boolean representing whether editOwnEvents permission is enabled or not. |
editOwnImagesboolean | Boolean representing whether editOwnImages permission is enabled or not. |
editOwnPostsboolean | Boolean representing whether editOwnPosts permission is enabled or not. |
editOwnProfileboolean | Boolean representing whether editOwnProfile permission is enabled or not. |
moderateAlbumsboolean | Boolean representing whether moderateAlbums permission is enabled or not. |
moveOwnTopicsboolean | Boolean representing whether moveOwnTopics permission is enabled or not. |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
postEventsboolean | Boolean representing whether postEvents permission is enabled or not. |
postPollsboolean | Boolean representing whether postPolls permission is enabled or not. |
replyOwnTopicsboolean | Boolean representing whether replyOwnTopics permission is enabled or not. |
replyTopicsboolean | Boolean representing whether replyTopics permission is enabled or not. |
requireEventApprovalboolean | Boolean representing whether requireEventApproval permission is enabled or not. |
requirePostApprovalboolean | Boolean representing whether requirePostApproval permission is enabled or not. |
setSelfAsInvisibleboolean | Boolean representing whether setSelfAsInvisible permission is enabled or not. |
signatureboolean | Boolean representing whether signature permission is enabled or not. |
startTopicsboolean | Boolean representing whether startTopics permission is enabled or not. |
titlestring | This is the name of user group. It is not shown to members but used to identify in User Group Manager. |
uploadAttachmentsboolean | Boolean representing whether uploadAttachments permission is enabled or not. |
uploadFilesboolean | Boolean representing whether uploadFiles permission is enabled or not. |
userGroupIdinteger | The unique identifier for a user group. |
viewAlbumsboolean | Boolean representing whether viewAlbums permission is enabled or not. |
viewAttachmentsboolean | Boolean representing whether viewAttachments permission is enabled or not. |
viewCalendarboolean | Boolean representing whether viewCalendar permission is enabled or not. |
viewCategoryboolean | Boolean representing whether viewCategory permission is enabled or not. |
viewForumboolean | Boolean representing whether viewForum permission is enabled or not. |
viewInvisibleMembersboolean | Boolean representing whether viewInvisibleMembers permission is enabled or not. |
viewOthersEventsboolean | Boolean representing whether viewOthersEvents permission is enabled or not. |
viewOthersTopicsboolean | Boolean representing whether viewOthersTopics permission is enabled or not. |
viewProfilesboolean | Boolean representing whether viewProfiles permission is enabled or not. |
viewTopicContentboolean | Boolean representing whether viewTopicContent permission is enabled or not. |
viewableOnMembersListboolean | Boolean representing whether viewableOnMembersList permission is enabled or not. |
voteOnPollsboolean | Boolean representing whether voteOnPolls permission is enabled or not. |
List user groups
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/usergroups \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/usergroups", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/usergroups", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/usergroups',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/usergroups', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/usergroups
Returns a list of all user groups.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
limit | query | integer | optional | A limit on the number of objects to be returned. Limit can range between 1 and 100 items, and the default is 10 items. |
page | query | integer | optional | Page number of results to return. |
title | query | string array | optional | It can be string or array which can be used to filter the results by the title of the user group. |
Example responses
200 Response
{
"data" : [
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of user groups. Each entry in the array is a separate user group object. This request should never throw an error.
Create a user group
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/usergroups \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/usergroups", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/usergroups", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/usergroups',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/usergroups', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/usergroups
Creates a new custom user group object.
Body parameter
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» changeUsername | body | boolean | optional | The changeUsername permission to create this object. |
» createAlbums | body | boolean | optional | The createAlbums permission to create this object. |
» customTitle | body | boolean | optional | The customTitle permission to create this object. |
» deleteOwnEvents | body | boolean | optional | The deleteOwnEvents permission to create this object. |
» deleteOwnImages | body | boolean | optional | The deleteOwnImages permission to create this object. |
» deleteOwnPosts | body | boolean | optional | The deleteOwnPosts permission to create this object. |
» deleteOwnProfile | body | boolean | optional | The deleteOwnProfile permission to create this object. |
» deleteOwnTopics | body | boolean | optional | The deleteOwnTopics permission to create this object. |
» downloadFiles | body | boolean | optional | Boolean representing whether downloadFiles permission is enabled or not. |
» editOwnEvents | body | boolean | optional | The editOwnEvents permission to create this object. |
» editOwnImages | body | boolean | optional | The editOwnImages permission to create this object. |
» editOwnPosts | body | boolean | optional | The editOwnPosts permission to create this object. |
» editOwnProfile | body | boolean | optional | The editOwnProfile permission to create this object. |
» moderateAlbums | body | boolean | optional | The moderateAlbums permission to create this object. |
» moveOwnTopics | body | boolean | optional | The moveOwnTopics permission to create this object. |
» postEvents | body | boolean | optional | The postEvents permission to create this object. |
» postPolls | body | boolean | optional | Boolean representing whether postPolls permission is enabled or not. |
» replyOwnTopics | body | boolean | optional | The replyOwnTopics permission to create this object. |
» replyTopics | body | boolean | optional | The replyTopics permission to create this object. |
» requireEventApproval | body | boolean | optional | The requireEventApproval permission to create this object. |
» requirePostApproval | body | boolean | optional | The requirePostApproval permission to create this object. |
» setSelfAsInvisible | body | boolean | optional | The setSelfAsInvisible permission to create this object. |
» signature | body | boolean | optional | The signature permission to create this object. |
» startTopics | body | boolean | optional | The startTopics permission to create this object. |
» title | body | string | required | This is the name of user group. It is not shown to members but used to identify in User Group Manager. |
» uploadAttachments | body | boolean | optional | The uploadAttachments permission to create this object. |
» uploadFiles | body | boolean | optional | Boolean representing whether uploadFiles permission is enabled or not. |
» viewAlbums | body | boolean | optional | The viewAlbums permission to create this object. |
» viewAttachments | body | boolean | optional | The viewAttachments permission to create this object. |
» viewCalendar | body | boolean | optional | The viewCalendar permission to create this object. |
» viewCategory | body | boolean | optional | The viewCategory permission to create this object. |
» viewForum | body | boolean | optional | The viewForum permission to create this object. |
» viewInvisibleMembers | body | boolean | optional | The viewInvisibleMembers permission to create this object. |
» viewOthersEvents | body | boolean | optional | The viewOthersEvents permission to create this object. |
» viewOthersTopics | body | boolean | optional | The viewOthersTopics permission to create this object. |
» viewProfiles | body | boolean | optional | The viewProfiles permission to create this object. |
» viewTopicContent | body | boolean | optional | The viewTopicContent permission to create this object. |
» viewableOnMembersList | body | boolean | optional | The viewableOnMembersList permission to create this object. |
» voteOnPolls | body | boolean | optional | Boolean representing whether voteOnPolls permission is enabled or not. |
Example responses
200 Response
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a user group object if the call succeeded. Throws an error if something goes wrong.
Retrieve a user group
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/usergroups/{usergroupId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/usergroups/{usergroupId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/usergroups/{usergroupId}
Retrieves the details of an existing user group. You need only supply the unique user group identifier.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
usergroupId | path | integer | required | The unique identifier for a user group. |
Example responses
200 Response
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a user group object if a valid identifier was provided.
Update a user group
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/usergroups/{usergroupId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/usergroups/{usergroupId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/usergroups/{usergroupId}
Update the user group
Body parameter
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
usergroupId | path | integer | required | The unique identifier for a user group. |
body | ||||
» changeUsername | body | boolean | optional | Boolean representing whether changeUsername permission is enabled or not. |
» createAlbums | body | boolean | optional | Boolean representing whether createAlbums permission is enabled or not. |
» customTitle | body | boolean | optional | Boolean representing whether customTitle permission is enabled or not. |
» defaultGroup | body | boolean | optional | Boolean representing whether defaultGroup permission is enabled or not. |
» deleteOwnEvents | body | boolean | optional | Boolean representing whether deleteOwnEvents permission is enabled or not. |
» deleteOwnImages | body | boolean | optional | Boolean representing whether deleteOwnImages permission is enabled or not. |
» deleteOwnPosts | body | boolean | optional | Boolean representing whether deleteOwnPosts permission is enabled or not. |
» deleteOwnProfile | body | boolean | optional | Boolean representing whether deleteOwnProfile permission is enabled or not. |
» deleteOwnTopics | body | boolean | optional | Boolean representing whether deleteOwnTopics permission is enabled or not. |
» downloadFiles | body | boolean | optional | Boolean representing whether downloadFiles permission is enabled or not. |
» editOwnEvents | body | boolean | optional | Boolean representing whether editOwnEvents permission is enabled or not. |
» editOwnImages | body | boolean | optional | Boolean representing whether editOwnImages permission is enabled or not. |
» editOwnPosts | body | boolean | optional | Boolean representing whether editOwnPosts permission is enabled or not. |
» editOwnProfile | body | boolean | optional | Boolean representing whether editOwnProfile permission is enabled or not. |
» moderateAlbums | body | boolean | optional | Boolean representing whether moderateAlbums permission is enabled or not. |
» moveOwnTopics | body | boolean | optional | Boolean representing whether moveOwnTopics permission is enabled or not. |
» object | body | string | optional | String representing the object’s type. Objects of the same type share the same value. |
» postEvents | body | boolean | optional | Boolean representing whether postEvents permission is enabled or not. |
» postPolls | body | boolean | optional | Boolean representing whether postPolls permission is enabled or not. |
» replyOwnTopics | body | boolean | optional | Boolean representing whether replyOwnTopics permission is enabled or not. |
» replyTopics | body | boolean | optional | Boolean representing whether replyTopics permission is enabled or not. |
» requireEventApproval | body | boolean | optional | Boolean representing whether requireEventApproval permission is enabled or not. |
» requirePostApproval | body | boolean | optional | Boolean representing whether requirePostApproval permission is enabled or not. |
» setSelfAsInvisible | body | boolean | optional | Boolean representing whether setSelfAsInvisible permission is enabled or not. |
» signature | body | boolean | optional | Boolean representing whether signature permission is enabled or not. |
» startTopics | body | boolean | optional | Boolean representing whether startTopics permission is enabled or not. |
» title | body | string | optional | This is the name of user group. It is not shown to members but used to identify in User Group Manager. |
» uploadAttachments | body | boolean | optional | Boolean representing whether uploadAttachments permission is enabled or not. |
» uploadFiles | body | boolean | optional | Boolean representing whether uploadFiles permission is enabled or not. |
» userGroupId | body | integer | optional | The unique identifier for a user group. |
» viewAlbums | body | boolean | optional | Boolean representing whether viewAlbums permission is enabled or not. |
» viewAttachments | body | boolean | optional | Boolean representing whether viewAttachments permission is enabled or not. |
» viewCalendar | body | boolean | optional | Boolean representing whether viewCalendar permission is enabled or not. |
» viewCategory | body | boolean | optional | Boolean representing whether viewCategory permission is enabled or not. |
» viewForum | body | boolean | optional | Boolean representing whether viewForum permission is enabled or not. |
» viewInvisibleMembers | body | boolean | optional | Boolean representing whether viewInvisibleMembers permission is enabled or not. |
» viewOthersEvents | body | boolean | optional | Boolean representing whether viewOthersEvents permission is enabled or not. |
» viewOthersTopics | body | boolean | optional | Boolean representing whether viewOthersTopics permission is enabled or not. |
» viewProfiles | body | boolean | optional | Boolean representing whether viewProfiles permission is enabled or not. |
» viewTopicContent | body | boolean | optional | Boolean representing whether viewTopicContent permission is enabled or not. |
» viewableOnMembersList | body | boolean | optional | Boolean representing whether viewableOnMembersList permission is enabled or not. |
» voteOnPolls | body | boolean | optional | Boolean representing whether voteOnPolls permission is enabled or not. |
Example responses
200 Response
{
"changeUsername" : "boolean",
"createAlbums" : "boolean",
"customTitle" : "boolean",
"defaultGroup" : "boolean",
"deleteOwnEvents" : "boolean",
"deleteOwnImages" : "boolean",
"deleteOwnPosts" : "boolean",
"deleteOwnProfile" : "boolean",
"deleteOwnTopics" : "boolean",
"downloadFiles" : "boolean",
"editOwnEvents" : "boolean",
"editOwnImages" : "boolean",
"editOwnPosts" : "boolean",
"editOwnProfile" : "boolean",
"moderateAlbums" : "boolean",
"moveOwnTopics" : "boolean",
"object" : "string",
"postEvents" : "boolean",
"postPolls" : "boolean",
"replyOwnTopics" : "boolean",
"replyTopics" : "boolean",
"requireEventApproval" : "boolean",
"requirePostApproval" : "boolean",
"setSelfAsInvisible" : "boolean",
"signature" : "boolean",
"startTopics" : "boolean",
"title" : "string",
"uploadAttachments" : "boolean",
"uploadFiles" : "boolean",
"userGroupId" : "integer",
"viewAlbums" : "boolean",
"viewAttachments" : "boolean",
"viewCalendar" : "boolean",
"viewCategory" : "boolean",
"viewForum" : "boolean",
"viewInvisibleMembers" : "boolean",
"viewOthersEvents" : "boolean",
"viewOthersTopics" : "boolean",
"viewProfiles" : "boolean",
"viewTopicContent" : "boolean",
"viewableOnMembersList" : "boolean",
"voteOnPolls" : "boolean"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns the user group object if the update succeeded.
Delete a custom user group
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/usergroups/{usergroupId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/usergroups/{usergroupId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/usergroups/{usergroupId}
Permanently deletes a custom user group. It cannot be undone.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
usergroupId | path | integer | required | The unique identifier for a user group. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Add users to a user group
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/usergroups/{usergroupId}/users", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/usergroups/{usergroupId}/users", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"emailAddresses" : [
"string array"
],
"userIds" : [
"integer array"
],
"usernames" : [
"string array"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/usergroups/{usergroupId}/users
You may use one of the following request body params to specify the users to add.
Body parameter
{
"emailAddresses" : [
"string array"
],
"userIds" : [
"integer array"
],
"usernames" : [
"string array"
]
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
usergroupId | path | integer | required | The unique identifier for a user group. |
body | ||||
» emailAddresses | body | [string array] | optional | A list of email addresses of members. |
» userIds | body | [integer array] | optional | A list of userIds of members. |
» usernames | body | [string array] | optional | A list of usernames of members. |
Example responses
200 Response
{
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the add succeeded.
Remove users from a user group
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/usergroups/{usergroupId}/users", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/usergroups/{usergroupId}/users", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/usergroups/{usergroupId}/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/usergroups/{usergroupId}/users
You may use one of the following request body params to specify the users to remove.
Body parameter
{
"emailAddresses" : [
"string array"
],
"userIds" : [
"integer array"
],
"usernames" : [
"string array"
]
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
usergroupId | path | integer | required | The unique identifier for a user group. |
body | ||||
» emailAddresses | body | [string array] | optional | A list of email addresses of members. |
» userIds | body | [integer array] | optional | A list of userIds of members. |
» usernames | body | [string array] | optional | A list of usernames of members. |
Example responses
200 Response
{
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Users
The user object
Parameter | Description |
---|---|
allowEmailsboolean | Boolean representing whether a member allows other members to send them emails. |
avatarUrlstring | The URL of an image representing the member in forum who created this object. |
canBanboolean | A boolean representing whether the logged in user can perform ban action on the user. Only specified if the x-api-username header has been provided. |
canDeleteboolean | A boolean representing whether the logged in user can perform delete action on the user. Only specified if the x-api-username header has been provided. |
canEditboolean | A boolean representing whether the logged in user can perform edit action on the user. Only specified if the x-api-username header has been provided. |
countryCode string | Country code of member. |
currentMonthPageViewsinteger | Current month page views count of member. |
customFieldsarray | A list of custom fields belongs to member. |
» objectstring | String representing the object’s type. Objects of the same type share the same value. |
» profileFieldIdinteger | The unique identifier of custom field that belongs to this object. |
» titlestring | The title of custom field. |
» typestring | The type of custom field. |
» valuestring | The value of custom field. |
emailstring | Email address of member. |
enableMessagesboolean | Boolean representing whether a member has permission to send messages or not. |
instantMessagingIdstring | Instant messaging id of member. |
instantMessagingTypestring | Instant messaging type of member. |
invalidEmailinteger | Number of invalid emails.(Read Only) |
ipAddress string | IP address of member. |
isBlockedboolean | It will be present if a user is logged in with x-api-username. |
isModeratorboolean | It will be true if the user is a moderator of any category.(Read Only) |
joinDateTimestampinteger | Time at which the member was created. Measured in seconds since the Unix epoch. |
lastPostTimestampinteger | Time at which the member was created last post. Measured in seconds since the Unix epoch. |
lastVisitTimestampinteger | Time at which the member was last visited. Measured in seconds since the Unix epoch. |
likeNotificationsboolean | It is a boolean representing if the user should receive web notifications when someone likes their post. |
namestring | The name of member. |
newNotificationCountinteger | Number of new notifications.(Read Only) |
objectstring | String representing the object’s type. Objects of the same type share the same value. |
offlineboolean | Boolean representing whether other users can see this user as online when they are browsing the forum. |
postCountinteger | The number of posts created by member. |
reputationinteger | It is a reputation score of member based on how much the community has liked their posts. The number of likes minus the number of dislikes a member's posts receive becomes their reputation score. |
signaturestring | Signature of member. |
unreadMessageCountinteger | Number of unread messages.(Read Only) |
userGroupsarray | A list of user groups that belongs to this member. |
userIdinteger | The unique identifier of member that belongs to this object. |
userTitlestring | The title of member. |
usernamestring | Username of member. |
List users
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/users?username=string \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/users", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/users", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/users', params={
'username':'string'
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/users
Returns a list of users on forum. The users are returned sorted by creation date, with the most recent users appearing first.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
username | query | string | optional | The username of member to filter out the results. |
postCount | query | operator value | optional | The post count of user to filter out the results. The value should be in the format of "operator value", where value can be a number and operator can be <, >, <=, >=, !=, or <>. For example: > 5. |
currentMonthPageViews | query | operator value | optional | The current month page views of user to filter out the results. The value should be in the format of "operator value", where value can be a number and operator can be <, >, <=, >=, !=, or <>. For example: > 5. |
userGroupId | query | integer | optional | The userGroupId of user to filter out the results. |
lastVisitTimestamp | query | operator value | optional | The lastVisitTimestamp of user to filter out the results. The value should be in the format of "operator value", where value can be a number and operator can be <, >, <=, >=, !=, or <>. For example: > 5. |
query | string | optional | The email of member to filter out the results. | |
limit | query | integer | optional | Limit the results for a particular request. Minimum is 1, maximum is 100 and default value is 10. |
page | query | integer | optional | Page number of results to return. |
lastPostTimestamp | query | operator value | optional | The lastPostTimestamp of user to filter out the results. The value should be in the format of "operator value", where value can be a number and operator can be <, >, <=, >=, !=, or <>. For example: > 5. |
joinDateTimestamp | query | operator value | optional | The joinDateTimestamp of user to filter out the results. The value should be in the format of "operator value", where value can be a number and operator can be <, >, <=, >=, !=, or <>. For example: > 5. |
includeId | query | integer | optional | When this parameter is provided, the API will return the page that includes the object with the ID specified in includeId. |
Example responses
200 Response
{
"data" : [
{
"allowEmails" : "boolean",
"avatarUrl" : "string",
"canBan" : "boolean",
"canDelete" : "boolean",
"canEdit" : "boolean",
"countryCode " : "string",
"currentMonthPageViews" : "integer",
"customFields" : [
{
"object" : "string",
"profileFieldId" : "integer",
"title" : "string",
"type" : "string",
"value" : "string"
}
],
"email" : "string",
"enableMessages" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"invalidEmail" : "integer",
"ipAddress " : "string",
"isBlocked" : "boolean",
"isModerator" : "boolean",
"joinDateTimestamp" : "integer",
"lastPostTimestamp" : "integer",
"lastVisitTimestamp" : "integer",
"likeNotifications" : "boolean",
"name" : "string",
"newNotificationCount" : "integer",
"object" : "string",
"offline" : "boolean",
"postCount" : "integer",
"reputation" : "integer",
"signature" : "string",
"unreadMessageCount" : "integer",
"userGroups" : [
"integer array"
],
"userId" : "integer",
"userTitle" : "string",
"username" : "string"
}
],
"has_more" : "boolean",
"object" : "string",
"size" : "integer",
"total_size" : "integer",
"url" : "string"
}
Returns
An array of up to limit users. Each entry in the array is a separate user object. If no more users are available, the resulting array will be empty. This request should never throw an error.
Create a user
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/users \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/users", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/users", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"adminEmails" : "boolean",
"allowEmails" : "boolean",
"autoFollow" : "string",
"avatarUrl" : "string",
"birthDate" : "string",
"customFields" : [
{
"profileFieldId" : "integer",
"value" : "string"
}
],
"digestEmails" : "boolean",
"email" : "string",
"enableMessages" : "boolean",
"eventEmails" : "boolean",
"followedContentEmailFrequency" : "string",
"followedContentNotifications" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"mentionEmails" : "boolean",
"mentionNotifications" : "boolean",
"messageEmails" : "boolean",
"name" : "string",
"namePrivate" : "boolean",
"offline" : "boolean",
"password" : "string",
"quoteEmails" : "boolean",
"quoteNotifications" : "boolean",
"signature" : "string",
"suppressEmails" : "boolean",
"userGroups" : [
"integer array"
],
"userTitle" : "string",
"username" : "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/users', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/users
Creates a new user object.
Note that if you're using Single Sign On, user accounts are automatically created if they don't exist during the log in request. Using the API to create user accounts isn't required.
Body parameter
{
"adminEmails" : "boolean",
"allowEmails" : "boolean",
"autoFollow" : "string",
"avatarUrl" : "string",
"birthDate" : "string",
"customFields" : [
{
"profileFieldId" : "integer",
"value" : "string"
}
],
"digestEmails" : "boolean",
"email" : "string",
"enableMessages" : "boolean",
"eventEmails" : "boolean",
"followedContentEmailFrequency" : "string",
"followedContentNotifications" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"mentionEmails" : "boolean",
"mentionNotifications" : "boolean",
"messageEmails" : "boolean",
"name" : "string",
"namePrivate" : "boolean",
"offline" : "boolean",
"password" : "string",
"quoteEmails" : "boolean",
"quoteNotifications" : "boolean",
"signature" : "string",
"suppressEmails" : "boolean",
"userGroups" : [
"integer array"
],
"userTitle" : "string",
"username" : "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
body | ||||
» adminEmails | body | boolean | optional | Boolean representing whether a member can receive admin emails or not. |
» allowEmails | body | boolean | optional | Boolean representing whether a member allows other members to send them emails. |
» autoFollow | body | string | optional | Automatically Follow. Value must be '' for 'Nothing', 'posts' for 'Topics I Start', 'threads' for 'Topics I Post In', 'alltopics' for All Topics. |
» avatarUrl | body | string | optional | The URL of an image representing the member in forum who created this object. |
» birthDate | body | string | optional | Birth date of member. Value should be in mm/dd/yy format. |
» customFields | body | array | optional | A list of custom fields belongs to member. |
» profileFieldId | body | integer | optional | The unique identifier of custom field that belongs to this object. |
» value | body | string | optional | The value of custom field. It can be string or array of strings depending on the type of custom field. |
» digestEmails | body | boolean | optional | Boolean representing whether a member receive a summary email when he haven’t visited the forum in over a week. |
body | string | required | The email address of the member. | |
» enableMessages | body | boolean | optional | Boolean representing whether a member has permission to send messages or not. |
» eventEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone posts an event. |
» followedContentEmailFrequency | body | string | optional | Choose how often a member want to be notified when content he follow is updated. Value can be 'never', 'weekly', 'daily', 'immediately'. |
» followedContentNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when content he follow, such as topics or categories, have new posts. |
» instantMessagingId | body | string | optional | Instant messaging id of the member. |
» instantMessagingType | body | string | optional | Instant messaging type of the member. |
» mentionEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone mentioned him in a post. |
» mentionNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when he is mentioned in a post. |
» messageEmails | body | boolean | optional | Boolean representing whether a member can receive an email when someone sends him a message. |
» name | body | string | optional | The name of the member. |
» namePrivate | body | boolean | optional | Boolean representing whether a member name can be private or not. |
» offline | body | boolean | optional | Boolean representing whether other users can see this user as online when they are browsing the forum. |
» password | body | string | required | The password of the member. |
» quoteEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone quotes his post. |
» quoteNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when someone quotes his post. |
» signature | body | string | optional | Signature of member. |
» suppressEmails | body | boolean | optional | Prevent the welcome, email verification, and admin notification emails from being sent. |
» userGroups | body | [integer array] | optional | A list of user groups that belongs to this member. |
» userTitle | body | string | optional | The title of member. |
» username | body | string | required | The username of the member. |
Example responses
200 Response
{
"allowEmails" : "boolean",
"avatarUrl" : "string",
"canBan" : "boolean",
"canDelete" : "boolean",
"canEdit" : "boolean",
"countryCode " : "string",
"currentMonthPageViews" : "integer",
"customFields" : [
{
"object" : "string",
"profileFieldId" : "integer",
"title" : "string",
"type" : "string",
"value" : "string"
}
],
"email" : "string",
"enableMessages" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"invalidEmail" : "integer",
"ipAddress " : "string",
"isBlocked" : "boolean",
"isModerator" : "boolean",
"joinDateTimestamp" : "integer",
"lastPostTimestamp" : "integer",
"lastVisitTimestamp" : "integer",
"likeNotifications" : "boolean",
"name" : "string",
"newNotificationCount" : "integer",
"object" : "string",
"offline" : "boolean",
"postCount" : "integer",
"reputation" : "integer",
"signature" : "string",
"unreadMessageCount" : "integer",
"userGroups" : [
"integer array"
],
"userId" : "integer",
"userTitle" : "string",
"username" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a user object if the call succeeded. Throws an error if something goes wrong.
Retrieve a user
Code samples
# You can also use wget
curl -X GET https://api.websitetoolbox.com/v1/api/users/{userId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("GET", "/api/users/{userId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("GET", "/api/users/{userId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users/{userId}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.get 'https://api.websitetoolbox.com/v1/api/users/{userId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.get('https://api.websitetoolbox.com/v1/api/users/{userId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users/{userId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
GET /api/users/{userId}
Retrieves the details of an existing user. You need only supply the unique user identifier that was returned upon user creation.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | path | integer | required | The unique identifier of member to filter out the results. |
Example responses
200 Response
{
"allowEmails" : "boolean",
"avatarUrl" : "string",
"canBan" : "boolean",
"canDelete" : "boolean",
"canEdit" : "boolean",
"countryCode " : "string",
"currentMonthPageViews" : "integer",
"customFields" : [
{
"object" : "string",
"profileFieldId" : "integer",
"title" : "string",
"type" : "string",
"value" : "string"
}
],
"email" : "string",
"enableMessages" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"invalidEmail" : "integer",
"ipAddress " : "string",
"isBlocked" : "boolean",
"isModerator" : "boolean",
"joinDateTimestamp" : "integer",
"lastPostTimestamp" : "integer",
"lastVisitTimestamp" : "integer",
"likeNotifications" : "boolean",
"name" : "string",
"newNotificationCount" : "integer",
"object" : "string",
"offline" : "boolean",
"postCount" : "integer",
"reputation" : "integer",
"signature" : "string",
"unreadMessageCount" : "integer",
"userGroups" : [
"integer array"
],
"userId" : "integer",
"userTitle" : "string",
"username" : "string"
}
404 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a user object if a valid identifier was provided.
Update a user
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/users/{userId} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/users/{userId}", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/users/{userId}", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"adminEmails" : "boolean",
"allowEmails" : "boolean",
"autoFollow" : "string",
"avatarUrl" : "string",
"birthDate" : "string",
"customFields" : [
{
"profileFieldId" : "integer",
"value" : "string"
}
],
"digestEmails" : "boolean",
"email" : "string",
"enableMessages" : "boolean",
"eventEmails" : "boolean",
"followedContentEmailFrequency" : "string",
"followedContentNotifications" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"likeNotifications" : "boolean",
"mentionEmails" : "boolean",
"mentionNotifications" : "boolean",
"messageEmails" : "boolean",
"name" : "string",
"namePrivate" : "boolean",
"offline" : "boolean",
"password" : "string",
"quoteEmails" : "boolean",
"quoteNotifications" : "boolean",
"signature" : "string",
"suppressEmails" : "boolean",
"userGroups" : [
"integer array"
],
"userTitle" : "string",
"username" : "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users/{userId}',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/users/{userId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/users/{userId}', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users/{userId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/users/{userId}
Updates the specified user by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request accepts mostly the same arguments as the user creation call.
Body parameter
{
"adminEmails" : "boolean",
"allowEmails" : "boolean",
"autoFollow" : "string",
"avatarUrl" : "string",
"birthDate" : "string",
"customFields" : [
{
"profileFieldId" : "integer",
"value" : "string"
}
],
"digestEmails" : "boolean",
"email" : "string",
"enableMessages" : "boolean",
"eventEmails" : "boolean",
"followedContentEmailFrequency" : "string",
"followedContentNotifications" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"likeNotifications" : "boolean",
"mentionEmails" : "boolean",
"mentionNotifications" : "boolean",
"messageEmails" : "boolean",
"name" : "string",
"namePrivate" : "boolean",
"offline" : "boolean",
"password" : "string",
"quoteEmails" : "boolean",
"quoteNotifications" : "boolean",
"signature" : "string",
"suppressEmails" : "boolean",
"userGroups" : [
"integer array"
],
"userTitle" : "string",
"username" : "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | path | integer | required | The unique identifier of member to filter out the results. |
body | ||||
» adminEmails | body | boolean | optional | Boolean representing whether a member can receive admin emails or not. |
» allowEmails | body | boolean | optional | Boolean representing whether a member allows other members to send them emails. |
» autoFollow | body | string | optional | Automatically Follow. Value must be '' for 'Nothing', 'posts' for 'Topics I Start', 'threads' for 'Topics I Post In', 'alltopics' for All Topics. |
» avatarUrl | body | string | optional | The URL of an image representing the member in forum who created this object. |
» birthDate | body | string | optional | Birth date of member. Value should be in mm/dd/yy format. |
» customFields | body | array | optional | A list of custom fields belongs to member. |
» profileFieldId | body | integer | optional | The unique identifier of custom field that belongs to this object. |
» value | body | string | optional | The value of custom field. It can be string or array of strings depending on the type of custom field. |
» digestEmails | body | boolean | optional | Boolean representing whether a member receive a summary email when he haven’t visited the forum in over a week. |
body | string | optional | The email address of the member. | |
» enableMessages | body | boolean | optional | Boolean representing whether a member has permission to send messages or not. |
» eventEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone posts an event. |
» followedContentEmailFrequency | body | string | optional | Choose how often a member want to be notified when content he follow is updated. Value can be 'never', 'weekly', 'daily', 'immediately'. |
» followedContentNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when content he follow, such as topics or categories, have new posts. |
» instantMessagingId | body | string | optional | Instant messaging id of member. |
» instantMessagingType | body | string | optional | Instant messaging type of the member. |
» likeNotifications | body | boolean | optional | It is a boolean representing if the user should receive web notifications when someone likes their post. |
» mentionEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone mentioned him in a post. |
» mentionNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when he is mentioned in a post. |
» messageEmails | body | boolean | optional | Boolean representing whether a member can receive an email when someone sends him a message. |
» name | body | string | optional | The name of member. |
» namePrivate | body | boolean | optional | Boolean representing whether a member name can be private or not. |
» offline | body | boolean | optional | Boolean representing whether other users can see this user as online when they are browsing the forum. |
» password | body | string | optional | The password of member. |
» quoteEmails | body | boolean | optional | Boolean representing whether a member receive an email when someone quotes his post. |
» quoteNotifications | body | boolean | optional | Boolean representing whether a member receive a web notification when someone quotes his post. |
» signature | body | string | optional | Signature of member. |
» suppressEmails | body | boolean | optional | If that option is enabled, it would not send any emails when the account is created. |
» userGroups | body | [integer array] | optional | A list of user groups that belongs to this member. |
» userTitle | body | string | optional | The title of member. |
» username | body | string | optional | The username of member. |
Example responses
200 Response
{
"allowEmails" : "boolean",
"avatarUrl" : "string",
"canBan" : "boolean",
"canDelete" : "boolean",
"canEdit" : "boolean",
"countryCode " : "string",
"currentMonthPageViews" : "integer",
"customFields" : [
{
"object" : "string",
"profileFieldId" : "integer",
"title" : "string",
"type" : "string",
"value" : "string"
}
],
"email" : "string",
"enableMessages" : "boolean",
"instantMessagingId" : "string",
"instantMessagingType" : "string",
"invalidEmail" : "integer",
"ipAddress " : "string",
"isBlocked" : "boolean",
"isModerator" : "boolean",
"joinDateTimestamp" : "integer",
"lastPostTimestamp" : "integer",
"lastVisitTimestamp" : "integer",
"likeNotifications" : "boolean",
"name" : "string",
"newNotificationCount" : "integer",
"object" : "string",
"offline" : "boolean",
"postCount" : "integer",
"reputation" : "integer",
"signature" : "string",
"unreadMessageCount" : "integer",
"userGroups" : [
"integer array"
],
"userId" : "integer",
"userTitle" : "string",
"username" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns the user object if the update succeeded.
Delete a user
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/users/{userId} \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/users/{userId}", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/users/{userId}", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users/{userId}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/users/{userId}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/users/{userId}', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users/{userId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/users/{userId}
Permanently deletes a user. It cannot be undone.
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | path | integer | required | The unique identifier of member to filter out the results. |
Example responses
200 Response
{
"status" : "string"
}
400 Response
{
"error" : {
"code" : "string",
"message" : "string",
"param" : "string"
},
"status" : "string"
}
Returns
Returns a parameter "status" with value success if the delete succeeded.
Follow Topics
Code samples
# You can also use wget
curl -X POST https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("POST", "/api/users/{userId}/followed_topics", array());
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
// Define array of request body.
$request_body = array();
$response = apiRequest("POST", "/api/users/{userId}/followed_topics", $request_body);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const inputBody = {
"topicIds" : [
"integer array"
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.post 'https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.post('https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics', data={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
POST /api/users/{userId}/followed_topics
Follow topics to get notified about new replies. It would take an array of topic IDs to follow.
Body parameter
{
"topicIds" : [
"integer array"
]
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | path | integer | required | The unique identifier of member to filter out the results. |
body | ||||
» topicIds | body | [integer array] | optional | An array of topic IDs to follow. |
Example responses
200 Response
{
"status" : "string"
}
Returns
Returns a parameter "status" with value success if follow succeeded.
Unfollow Topics
Code samples
# You can also use wget
curl -X DELETE https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics \
-H 'Accept: application/json' \
-H 'x-api-key: string' \
-H 'x-api-username: string'
<?php
define("FORUM_API_KEY", string);
/*
* Examples:
* apiRequest("DELETE", "/api/users/{userId}/followed_topics", null);
*/
function apiRequest ($method, $path, $data){
$url = "https://api.websitetoolbox.com/v1$path";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"x-api-key: ".FORUM_API_KEY,
'Content-Type: application/json',
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if (strtoupper($method) == "POST") {
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, json_encode($data));
} else if (strtoupper($method) == "DELETE") {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
}
$response = curl_exec($curl);
curl_close($curl);
$namedArray = json_decode($response);
return $namedArray;
}
$response = apiRequest("DELETE", "/api/users/{userId}/followed_topics", null);
echo json_encode($response);
?>
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'x-api-key':'string',
'x-api-username':'string'
};
fetch('https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'x-api-key' => 'string',
'x-api-username' => 'string'
}
result = RestClient.delete 'https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json',
'x-api-key': 'string',
'x-api-username': 'string'
}
r = requests.delete('https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics', params={
}, headers = headers)
print(r.json())
URL obj = new URL("https://api.websitetoolbox.com/v1/api/users/{userId}/followed_topics");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
DELETE /api/users/{userId}/followed_topics
To stop getting notified about new replies. It would take an array of topic IDs to unfollow.
Body parameter
{
"topicIds" : [
"integer array"
]
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
x-api-key | header | string | required | Your secret API key to authenticate your account. |
x-api-username | header | string | optional | The username of the user that you'd like to make the request as. Use "Anonymous" to make the request as a user that isn't logged in. |
userId | path | integer | required | The unique identifier of member to filter out the results. |
body | ||||
» topicIds | body | [integer array] | optional | An array of topic IDs to unfollow. |
Example responses
200 Response
{
"status" : "string"
}
Returns
Returns a parameter "status" with value success if unfollow succeeded.