java python shell

Introduction

Gametize API Documentation


      ######    #####    ### ###   #######  ########  #  #######  #######
     #      #  #     #  #   #   #  #           #      #       #   #
     #         #     #  #   #   #  #           #      #      #    #
     #         #######  #   #   #  ######      #      #     #     ######
     #    ###  #     #  #   #   #  #           #      #    #      #
     #      #  #     #  #   #   #  #           #      #   #       #
      ######   #     #  #   #   #  #######     #      #  #######  #######


                 ###########################################
               ###############################################
              #################################################
              #################################################
              #################################################
              #################################################
              ###                                           ###
              ##                                             ##
              ##        #####                  #####         ##
              ##       #     #                #     #        ##
              ##                                             ##
              ##                  #      #                   ##
              ##                   ######                    ##
              ###                                           ######
               ###################################################
                  ###############################################
                 ###########################################
               #########################################
             ######  ###################################
            ######   ###################################
            #####    ###################################
                     ###################################
                     ###################################
                     ###################################
                     ###################################
                     #######                     #######
                      ####                         ####


      ######    #####    ### ###   #######  ########  #  #######  #######
     #      #  #     #  #   #   #  #           #      #       #   #
     #         #     #  #   #   #  #           #      #      #    #
     #         #######  #   #   #  ######      #      #     #     ######
     #    ###  #     #  #   #   #  #           #      #    #      #
     #      #  #     #  #   #   #  #           #      #   #       #
      ######   #     #  #   #   #  #######     #      #  #######  #######


                 ###########################################
               ###############################################
              #################################################
              #################################################
              #################################################
              #################################################
              ###                                           ###
              ##                                             ##
              ##        #####                  #####         ##
              ##       #     #                #     #        ##
              ##                                             ##
              ##                  #      #                   ##
              ##                   ######                    ##
              ###                                           ######
               ###################################################
                  ###############################################
                 ###########################################
               #########################################
             ######  ###################################
            ######   ###################################
            #####    ###################################
                     ###################################
                     ###################################
                     ###################################
                     ###################################
                     #######                     #######
                      ####                         ####


      ######    #####    ### ###   #######  ########  #  #######  #######
     #      #  #     #  #   #   #  #           #      #       #   #
     #         #     #  #   #   #  #           #      #      #    #
     #         #######  #   #   #  ######      #      #     #     ######
     #    ###  #     #  #   #   #  #           #      #    #      #
     #      #  #     #  #   #   #  #           #      #   #       #
      ######   #     #  #   #   #  #######     #      #  #######  #######


                 ###########################################
               ###############################################
              #################################################
              #################################################
              #################################################
              #################################################
              ###                                           ###
              ##                                             ##
              ##        #####                  #####         ##
              ##       #     #                #     #        ##
              ##                                             ##
              ##                  #      #                   ##
              ##                   ######                    ##
              ###                                           ######
               ###################################################
                  ###############################################
                 ###########################################
               #########################################
             ######  ###################################
            ######   ###################################
            #####    ###################################
                     ###################################
                     ###################################
                     ###################################
                     ###################################
                     #######                     #######
                      ####                         ####

The Gametize API is meant for developers who are keen to create their own client applications making use of the Gametize platform.

Alerts

To help you understand this document better, we have included some "alerts" which are specially-formatted text snippets which highlight important points. Here are some examples of the types of "alerts" you can expect to see in this API documentation.

Testing Endpoints

In order to test endpoints, you'll need to have a project on Gametize first! You can get the API key for your project by sending an email to support@gametize.com and describing what you'll be using the Gametize API for. Not only does this helps us manage the usage of the Gametize API, it helps you by making the development team aware of your use case, and lets us plan better features and endpoints to help you out!

Once you've gotten your API key, you can use the code snippets provided and replace the asterisks with your own API key to get started with development. Note that your project(s) will need some users, content and/or activity for your endpoints to return accurate data, so take some time to ensure everything in your project is in good order!

Terminology

This section on the right will display sample code for you to refer to when making your API calls. Switch between the different languages in the tabs located at the top! Note that some parameters and JSON fields may be obfuscated with asterisks (*) or some placeholder text, but the structure of the returns are preserved as much as possible. Please note that the number of asterisks may not indicate the character count/length of the value.

In order to effectively use the Gametize API, some understanding of the information hierarchy of the Gametize platform is required! A brief overview to the platform will be available here soon, so watch this space!

Authentication

The sample code for authenticating the user can be found in the login section of this document, but is replicated here for easy access. Note that the password is obfuscated here, and is not actually comprised of 8 asterisks; you would include the password in the HTTP request as the user enters it in your own application.

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/login.json", 
            "api_key=********************************", 
            "email=player1@gametize.com",
            "password=********"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/package/ID.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache'}
data = {'api_key':'********************************', 'email':'player1@gametize.com', 'password':'********'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/login.json \
-H 'Content-Type':'application/x-www-form-urlencoded' \
-H 'Cache-Control':'no-cache' \
-d 'api_key=********************************' \
-d 'email=player1@gametize.com' \
-d 'password=********'

The above code returns a session_key enclosed within a JSON object if the user is authenticated successfully, shown below.

{
    "code": 200,
    "sessionKey": "*-********-****-****-****-************",
    "firstLogin": true,
    "newRegistration": false,
    "userPrivacyAgreed": 0,
    "language": "en",
    "userMarketingConsent": 0,
    "userId": 2,
    "projectId": 1,
    "user": {
        "country": "UNKNOWN",
        "userImage": "https://gametize.com/somepath/someimage.png",
        "id": 2,
        "userName": "player1"
    }
}

Authenticating Your Application

In Gametize, all applications are assigned an API Key. This API key is used to verify the identity of the API client application when a user logs in.

You can find your API key listed in the project view when logged into the Administrator Dashboard, under the project's name. Use the URL https://gametize.com/admin/ and log in using your Gametize administrator account to access the Administrator Dashboard.

Verifying Your Users

All actions done by the user through the API (such as completing challenges, commenting on challenges and completions, and voting on challenges or completions) use a session_key to identify the user. This session_key is returned when the user is logged in via the API; you may refer to the login section for more details.

To quote Google on this practice:

Register

Register User

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executePost("https://gametize.com/api2/register.json",
            "api_key=********************************",
            "email=player5@gametize.com",
            "password=********",
            "user_name=Player5"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/register.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', \
'Cache-Control':'no-cache', 'Accept':'application/json'}
data = {'api_key':'********************************', 'user_name':'Player 5',\
 'email':'player5@gametize.com', 'password':'********'}

req = requests.post(url, data=data, headers=headers)

print(req.text)

curl -X POST https://gametize.com/api2/register.json \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'api_key=********************************' \
    -d 'email=player5@gametize.com'\
    -d 'password=********' \
    -d 'user_name=Player 5'

The above code returns JSON structured like this:

{
    "code": 200,
    "sessionKey": "*-********-****-****-****-************",
    "firstLogin": true,
    "language": "en",
    "id": 32,
    "userId": 10,
    "user": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "id": 10,
        "userName": "player5"
    },
    "projectId": 1
}

This endpoint registers a new user and keeps them logged in if users are not required to confirm their email (which is a project level setting).

HTTP Request

POST https://gametize.com/api2/register.json

Parameter(s)

Name Usage Default Example Description
api_key required null 207302fde5e7-097a-4971-a4d4-de7154113ed7 Validates the identity of the API client.
email required null someone@somedomain.com The email address of the new user.
password required null qwRtys57! The new password to set for the user.
user_name required null firstName lastName The new user's name - will be displayed to the user.

Login / Logout

If you've been referred here from the Authentication section, please note that you will need your API Key to perform these API calls!

Perform User Login

The password parameter in this example is obfuscated in this example, but make sure you include the proper password in your own requests!

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executePost("https://gametize.com/api2/login.json",
            "api_key=********************************",
            "email=player1@gametize.com",
            "password=********"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/login.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', \
'Cache-Control':'no-cache', 'Accept':'application/json'}
data = {'api_key':'********************************', \
'email':'player1@gametize','password':'********'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/login.json \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'api_key=********************************' \
    -d 'email=player1@gametize' \
    -d 'password=********'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "sessionKey": "*-********-****-****-****-************",
    "firstLogin": true,
    "newRegistration": false,
    "userPrivacyAgreed": 0,
    "language": "en",
    "userMarketingConsent": 0,
    "userId": 2,
    "projectId": 1,
    "user": {
        "country": "UNKNOWN",
        "userImage": "https://gametize.com/somepath/someimage.png",
        "id": 2,
        "userName": "player1"
    }
}

This endpoint logs a user in using an email and a password.

HTTP Request

POST https://gametize.com/api2/login.json

Parameter(s)

Name Usage Default Example Description
api_key required null 207302fde5e7-097a-4971-a4d4-de7154113ed7 Validates the identity of the API client.
email required null someone@somedomain.com The email address of the user.
password required null qwRtys57! The password of the user.
device_token optional null asjh8712871D7812jJ The token of an iOS device - required for Push Notifications.

Perform User Logout

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executePost("https://gametize.com/api2/logout.json"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/logout.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', \
'Cache-Control':'no-cache', 'Accept':'application/json'}

req = requests.post(url, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/logout.json \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' 

The above code returns a JSON object structured like this:

{
    "code": 200,
}

This endpoint logs out a user using the current session key.

HTTP Request

POST https://gametize.com/api2/logout.json

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Users

User Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "country": "Not Applicable",
    "achievements": [
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 1",
            "id": 1,
            "achievementName": "Achievement 1",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        },
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 2",
            "id": 2,
            "achievementName": "Achievement 2",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        },
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 3",
            "id": 3,
            "achievementName": "Achievement 3",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        }
    ],
    "code": 200,
    "userPrivacyAgreed": 1,
    "pointsAvailable": 0,
    "userName": "player1",
    "userFollowerCount": 1,
    "points": 140,
    "userImage": "https://gametize.com/somepath/someimage.png",
    "completionCount": 0,
    "userEmail": "player1@gametize.com",
    "userGender": "n",
    "userMarketingConsent": 0,
    "id": 2,
    "userFollowings": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 3,
            "userName": "player2",
            "userFollowed": true
        }
    ],
    "userFollowers": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 4,
            "userName": "player3",
            "userFollowed": false
        }
    ],
    "userFollowingCount": 1,
    "userEmailPermit": 1
}

Note that if a user's profile is fetched for viewing using their own authentication token, an additional entry is returned, structured as
"userEmailPermit": <value>
where <value> can be 0 which indicates email notifications are disabled or 1 which indicates that email notifications are enabled.

This endpoint retrieves a detailed profile of the specified user.

HTTP Request

GET https://gametize.com/api2/users/ID.json

Parameter(s)

Name Usage Default Example Description
project_id optional 0 3 Get user data in respect to a project. For example, returns user points and items in a project.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

User Widget

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/widget.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/widget.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/widget.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "userImage": "https://gametize.com/somepath/someimage.png",
    "code": 200,
    "completionCount": 0,
    "pointsAvailable": 0,
    "id": 2,
    "userName": "player1",
    "points": 0
}

This endpoint retrieves a profile overview of the specified user.

HTTP Request

GET https://gametize.com/api2/users/ID/widget.json

Parameter(s)

Name Usage Default Example Description
project_id optional 0 3 Get user data with respect to a topic.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Followers

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/followers.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/followers.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/followers.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 3,
            "userName": "player2",
            "userFollowed": false
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 4,
            "userName": "player3",
            "userFollowed": false
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 5,
            "userName": "player4",
            "userFollowed": false
        }
    ],
    "more": false
}

This endpoint retrieves a list of users who follow the specified user.

HTTP Request

GET https://gametize.com/api2/users/ID/followers.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Following

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/following.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/following.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/following.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 3,
            "userName": "player2",
            "userFollowed": true
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 4,
            "userName": "player3",
            "userFollowed": true
        }
    ],
    "more": false
}

This endpoint retrieves a list of users that the specified user follows.

HTTP Request

GET https://gametize.com/api2/users/ID/following.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Joined Projects

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/projects.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/projects.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/projects.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "projectBannerImage": "https://gametize.com/somepath/someimage.png",
            "private": false,
            "teamEnabled": false,
            "id": 2,
            "searchEnabled": false,
            "guestEnabled": false,
            "projectTitle": "API test project"
        }
    ],
    "more": false
}

This endpoints retrieves a list of projects the specified user is participating/has participated in.

HTTP Request

GET https://gametize.com/api2/users/ID/projects.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Accepted Challenges

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/accepts.json", 
            "project_id=2", 
            "page=1", 
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/accepts.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'project_id':'2', 'page':'1', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/accepts.json?project_id=2&page=1&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "challengeCompleted": true,
            "locationOnly": false,
            "challengeAcceptedCount": 2,
            "challengeDescription": "Test Poll Description",
            "photoOnly": false,
            "completionIsPrivate": false,
            "points": 0,
            "createdAt": "2018-07-13 11:16:25.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeAccepted": true,
            "completionCount": 2,
            "repeat": false,
            "options": [
                {
                    "optionTitle": "Poll 1",
                    "id": 1,
                    "optionAnswered": true,
                    "defaultCompletionMessage": "You selected Poll 1"
                }
            ],
            "completionMessage": "You selected Poll 1",
            "id": 1,
            "createdAtFormatted": "4 hours ago",
            "noPhoto": false,
            "challengeImageType": "landscape",
            "challengeVoted": false,
            "challengeTitle": "Test Poll",
            "challengeType": "survey",
            "confirmation": false,
            "commentCount": 1,
            "challengeTypeId": 11,
            "voteCount": 0,
            "challengeCompletedBefore": true,
            "challengeBookmarked": false,
            "multiSelect": false
        },
        {
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "challengeCompleted": true,
            "locationOnly": false,
            "challengeAcceptedCount": 2,
            "challengeDescription": "Test Option Description",
            "photoOnly": false,
            "completionIsPrivate": false,
            "points": 10,
            "createdAt": "2018-07-13 11:16:35.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeAccepted": true,
            "completionCount": 2,
            "repeat": false,
            "options": [
                {
                    "optionTitle": "Yes",
                    "id": 2,
                    "optionAnswered": true
                }
            ],
            "id": 2,
            "createdAtFormatted": "4 hours ago",
            "noPhoto": false,
            "challengeImageType": "landscape",
            "challengeVoted": false,
            "challengeTitle": "Test Option",
            "challengeType": "survey",
            "confirmation": true,
            "commentCount": 0,
            "challengeTypeId": 11,
            "voteCount": 0,
            "challengeCompletedBefore": true,
            "challengeBookmarked": false,
            "multiSelect": false
        }
    ],
    "more": false
}

This endpoint retrieves a list of challenges that the specified user has accepted within the specified project.

HTTP Request

GET https://gametize.com/api2/users/ID/accepts.json

Parameter(s)

Name Usage Default Example Description
project_id required 0 3 Filter the accepted challenges by a specific project.
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Bookmarked Challenges

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/bookmarks.json", 
            "project_id=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/bookmarks.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'project_id':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/bookmarks.json?project_id=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "challengeCompleted": true,
            "locationOnly": false,
            "challengeAcceptedCount": 2,
            "challengeDescription": "Test Challenge",
            "photoOnly": false,
            "completionIsPrivate": false,
            "createdAt": "2018-07-13 11:16:45.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeAccepted": true,
            "completionCount": 1,
            "repeat": false,
            "id": 3,
            "createdAtFormatted": "5 hours ago",
            "noPhoto": false,
            "challengeImageType": "landscape",
            "challengeVoted": false,
            "challengeTitle": "Challenge 5",
            "challengeType": "normal",
            "commentCount": 1,
            "challengeTypeId": 1,
            "voteCount": 0,
            "challengeCompletedBefore": true,
            "challengeBookmarked": true
        }
    ],
    "more": false
}

This endpoint retrieves a list of challenges that the specified user has bookmarked.

HTTP Request

GET https://gametize.com/api2/users/ID/bookmarks.json

Parameter(s)

Name Usage Default Example Description
project_id required 0 3 Filter the bookmarked challenges by a specific project.
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Earned Achievements

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/achievements.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/achievements.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/achievements.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 1",
            "id": 1,
            "achievementName": "Achievement 1",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        },
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 2",
            "id": 2,
            "achievementName": "Achievement 2",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        },
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 3",
            "id": 3,
            "achievementName": "Achievement 3",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        }
    ],
    "more": false
}

This endpoint retrieves a list of achievements earned by the specified user.

HTTP Request

GET https://gametize.com/api2/users/ID/achievements.json

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Redeemed Rewards

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/users/2/rewards.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/users/2/rewards.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/users/2/rewards.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "user": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "completionCount": 0,
        "pointsAvailable": 0,
        "id": 2,
        "userName": "player1",
        "points": 0
    },
    "code": 200,
    "data": [
        {
            "id": 10,
            "rewardId": 1,
            "name": "Reward 1",
            "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
            "rewardImageLarge": "https://gametize.com/somepath/someimage.png",
            "rewardDescription": "Reward 1 Description"
        },
        {
            "id": 11,
            "rewardId": 2,
            "name": "Reward 2",
            "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
            "rewardImageLarge": "https://gametize.com/somepath/someimage.png",
            "rewardDescription": "Reward 2 Description"
        },
        {
            "id": 12,
            "rewardId": 3,
            "name": "Reward 3"
            "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
            "rewardImageLarge": "https://gametize.com/somepath/someimage.png",
            "rewardDescription": "Reward 3 Description"
        }
    ],
    "more": false,

}

This endpoint gets a list of rewards redeemed by the specified user. Note that the user is prohibited from viewing other users' redeemed rewards.

HTTP Request

GET https://gametize.com/api2/users/ID/rewards.json

Parameter(s)

Name Usage Default Example Description
project_id optional 0 3 Filter the redeemed rewards by a specific project.
page optional 1 1 Specifies which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Teams

Team Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/teams/1.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/teams/1.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/teams/1.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns JSON structured like this:

{
    "teamName": "Team 1",
    "teamImage": "https://gametize.com/somepath/someimage.png",
    "code": 200,
    "userCount": 2,
    "id": 1,
    "teamDescription": "Team 1 Description",
    "points": 256
}

This endpoint retrieves the detailed profile of the specified team.

HTTP Request

GET https://gametize.com/api2/teams/ID.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Team Members

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/teams/1/users.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
         try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/teams/1/users.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/teams/1/users.json' \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns JSON structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 2,
            "userName": "player1",
            "points": 2583
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 4,
            "userName": "player3",
            "points": 233
        }
    ],
    "more": false,
    "team": {
        "teamName": "Team 1",
        "teamImage": "https://gametize.com/somepath/someimage.png",
        "userCount": 2,
        "id": 1,
        "teamDescription": "Team 1 Description"
    }
}

This endpoint retrieves the list of users in a team.

HTTP Request

GET https://gametize.com/api2/teams/ID/users.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Projects

Project Topics

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/topics.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/topics.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/topics.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "unlockable": false,
            "private": false,
            "topicIconImage": "https://gametize.com/somepath/someimage.png",
            "id": 1,
            "challengeCount": 4,
            "createdAtFormatted": "1 day ago",
            "topicBannerImage": "https://gametize.com/somepath/someimage.png",
            "topicDescription": "Test Project Description",
            "topicTitle": "Test Project",
            "commentCount": 0,
            "topicType": "standard"
        }
    ],
    "more": false,
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

This endpoint retrieves a list of topics in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/topics.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Categories

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/categories.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/categories.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/categories.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "categoryImage": "https://gametize.com/somepath/someimage.png",
            "categorySelected": false,
            "id": 50,
            "categoryName": "Category 1"
        }
    ],
    "more": false
}

This endpoint returns a list of categories in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/categories.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Challenges

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/challenges.json
            "page=6",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/challenges.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'6', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/challenges.json?page=6&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "challengeImageType": "landscape",
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "locationOnly": false,
            "challengeTitle": "Test FlashCard",
            "challengeAcceptedCount": 1,
            "challengeType": "non-interactive",
            "challengeDescription": "Testing Flashcard Description",
            "photoOnly": false,
            "repeatEveryFormatted": "1 hour",
            "completionIsPrivate": false,
            "commentCount": 0,
            "createdAt": "2018-07-11 18:16:00.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeTypeId": 4,
            "completionCount": 0,
            "repeat": true,
            "id": 100723,
            "voteCount": 1,
            "createdAtFormatted": "1 day ago",
            "noPhoto": false
        },
        {
            "challengeImageType": "landscape",
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "locationOnly": false,
            "challengeTitle": "Test Poll",
            "challengeAcceptedCount": 2,
            "challengeType": "survey",
            "challengeDescription": "Test Poll Description",
            "confirmation": false,
            "photoOnly": false,
            "completionIsPrivate": false,
            "commentCount": 1,
            "points": 0,
            "createdAt": "2018-07-11 18:23:36.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeTypeId": 11,
            "completionCount": 2,
            "repeat": false,
            "options": [
                {
                    "optionTitle": "Poll 1",
                    "id": 1,
                    "defaultCompletionMessage": "You selected Poll 1"
                }
            ],
            "id": 1,
            "voteCount": 0,
            "createdAtFormatted": "1 day ago",
            "noPhoto": false,
            "multiSelect": false
        }
    ],
    "more": false,
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

This endpoint returns a list of challenges in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/challenges.json

Parameter(s)

Name Usage Default Example Description
keywords required null holiday Specify the search keywords.
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.
category_id optional null 2 Filter results to only show challenges under the specified category.
order optional null id_asc Sorts results by the specified order.
Supported orders:
  • completion_asc (no. of claims, ascending),
  • completion_desc (no. of claims, descending),
  • id_asc (challenge ID, ascending),
  • id_desc (challenge ID descending).

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Completions

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/completions.json",
            "page=3",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/completions.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'3', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/completions.json?page=3&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "challenge": {
                "completionByAdminOnly": false,
                "challengeTypeId": 11,
                "locationOnly": false,
                "challengeTitle": "Test Options",
                "challengeType": "survey",
                "id": 2,
                "confirmation": true,
                "photoOnly": false,
                "completionIsPrivate": false,
                "multiSelect": false
            },
            "id": 2,
            "voteCount": 0,
            "createdAtFormatted": "4 hours ago",
            "userName": "player1",
            "userId": 2,
            "commentCount": 0,
            "points": 20
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "challenge": {
                "completionByAdminOnly": false,
                "challengeTypeId": 11,
                "locationOnly": false,
                "challengeTitle": "Test Poll",
                "challengeType": "survey",
                "id": 1,
                "confirmation": false,
                "photoOnly": false,
                "completionIsPrivate": false,
                "multiSelect": false
            },
            "id": 1,
            "voteCount": 0,
            "createdAtFormatted": "4 hours ago",
            "userName": "player1",
            "userId": 2,
            "commentCount": 0,
            "points": 35
        }
    ],
    "more": false,
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

This endpoint returns a list of completions for all challenges in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/completions.json

Parameter(s)

Name Usage Default Example Description
user_id optional 0 2 Get claims in respect to a particular user in the project.
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.
type optional null following Get completions in respect to certain classification for the logged in user (Authorization must be provided in the header). Available options: following.
filter optional null image filter data based on content type. Available options: image, video.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Achievements

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/achievements.json",
            "user_id=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/achievements.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'user_id':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/achievements.json?user_id=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 1",
            "id": 1,
            "achievementName": "Achievement 1",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        }
    ],
    "more": false
}

This endpoint retrieves a list of achievements in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/achievements.json

Parameter(s)

Name Usage null Example Description
user_id optional 0 2 Get achievements with respect to a particular user in the project.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Store

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/store.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/store.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/store.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
            "rewardName": "Reward 1",
            "createdAt": "2018-07-01 17:54:02.0",
            "ownedQuantityLimit": 1,
            "price": 30,
            "rewardDescription": "Reward 1 Description",
            "id": 1,
            "createdAtFormatted": "01 Jul 2018",
            "rewardImageLarge": "https://gametize.com/somepath/someimage.png",
            "adminToAward": false
        },
        {
            "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
            "rewardName": "Reward 2",
            "createdAt": "2018-07-01 17:56:02.0",
            "ownedQuantityLimit": 1,
            "price": 30,
            "rewardDescription": "Reward 2 Description",
            "id": 2,
            "createdAtFormatted": "01 Jul 2018",
            "rewardImageLarge": "https://gametize.com/somepath/someimage.png",
            "adminToAward": false
        }
    ],
    "more": false,
    "categories": [
        {
            "categorySelected": false,
            "id": 1,
            "categoryName": "Rewards"
        }
    ]
}

This endpoint retrieves a list of redeemable rewards in a project.

HTTP Request

GET https://gametize.com/api2/projects/ID/store.json

Paramater(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Get data with respect to you. This includes whether you have earned this item or not.

Project Users

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("ttps://gametize.com/api2/projects/2/users.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'ttps://gametize.com/api2/projects/2/users.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET ttps://gametize.com/api2/projects/2/users.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 2,
            "userName": "player1"
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 3,
            "userName": "player2"
        }
    ],
    "more": false
}

This endpoint retrieves a list of users in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/users.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Teams

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/teams.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/teams.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/teams.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "teamName": "Team 1",
            "userCount": 2,
            "id": 1,
            "teamDescription": "Team 1 Description"
        },
        {
            "teamName": "Team 2",
            "userCount": 2,
            "id": 2,
            "teamDescription": "Team 2 Description"
        }
    ],
    "more": true
}

This endpoint retrieves a list of teams in the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/teams.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Leaderboard

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/leaderboard.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/leaderboard.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/leaderboard.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 1,
            "id": 2,
            "userName": "player1",
            "points": 40
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 2,
            "id": 3,
            "userName": "player2",
            "points": 30
        }
    ],
    "more": false
}

This endpoint retrieves the leaderboard of the specified project.

HTTP Request

GET https://gametize.com/api2/projects/ID/leaderboard.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.
keywords optional null Team 1 Specify which team to get leaderboard from.
type optional overall monthly Specify how the leaderboard is sorted. Available types: overall, monthly, weekly, daily.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Project Leaderboard Overview

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/leaderboard_overiew.json",
            "user_id=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/leaderboard_overview.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'user_id':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/leaderboard_overview.json?user_id=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "lowestRank": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "rank": 2,
        "id": 3,
        "userName": "player2",
        "points": 30
    },
    "mainBoard": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 1,
            "id": 2,
            "userName": "player1",
            "points": 40
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 2,
            "id": 3,
            "userName": "player2",
            "points": 30
        }
    ],
    "code": 200,
    "highestRank": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "rank": 1,
        "id": 2,
        "userName": "player1",
        "points": 40
    },
    "type": [
        {
            "typeName": "monthly",
            "typeSelected": false
        },
        {
            "typeName": "weekly",
            "typeSelected": false
        },
        {
            "typeName": "daily",
            "typeSelected": false
        },
        {
            "typeName": "overall",
            "typeSelected": true
        }
    ]
}

This endpoint retrieves the leaderboard overview of a project.

HTTP Request

GET https://gametize.com/api2/topics/ID/leaderboard_overview.json

Parameter(s)

Name Usage Default Example Description
user_id see notes below 0 2 Get the leaderboard overview with respect to a particular user in a topic.
team_id see notes below 0 1 Get the leaderboard overview with respect to a particular team in a topic.
team optional false true Specify if the leaderboard should be filtered by teams. Permitted values: true/false
group optional false true Specify if the leaderboard should be filtered by groups. Permitted values: true/false
type optional overall monthly Specify how the leaderboard is sorted by. Available type: overall, monthly, weekly, daily.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identify the user who is viewing the leaderboard overview and is required if the topic or project is private.

Validate

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/validate.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/validate.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/validate.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "id": 2,
    "projectTitle": "API test Project"
}

This endpoint retrieves the project details with respect to a logged-in user.

HTTP Request

GET https://gametize.com/api2/projects/(ID or ALIAS)/validate.json

Display Pop-up Alert

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/projects/2/alerts.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/projects/2/alerts.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/projects/2/alerts.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "alertTitle": "Sample Alert",
    "alertImage": "https://gametize.com/somepath/someimage.png",
    "alertUrl": "https://someurl.com"
}

This endpoint fetches the details of the pop-up alert configured for the project. This pop-up alert contains a title, an image, and - optionally - a linked URL.

HTTP Request

GET https://gametize.com/api2/projects/ID/alerts.json

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the logged-in user.

Topics

Topics are a way for project administrators to group contents (i.e. challenges or flashcards) into their projects. Use Topics to define levels, or to group similar challenges together.

Topic Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "unlockable": false,
    "private": false,
    "code": 200,
    "topicIconImage": "https://gametize.com/somepath/someimage.png",
    "id": 1,
    "challengeCount": 4,
    "createdAtFormatted": "1 day ago",
    "topicBannerImage": "https://gametize.com/somepath/someimage.png",
    "topicDescription": "Test Topic Description",
    "topicTitle": "Test Topic",
    "commentCount": 0,
    "topicType": "standard"
}

This endpoint retrieves the detailed profile of the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Challenges

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/challenges.json",
            "page=3",
            "limit=1"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/challenges.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'3', 'limit':'1'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/challenges.json?page=3&limit=1 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "challengeImageType": "landscape",
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "locationOnly": false,
            "challengeTitle": "Test FlashCard",
            "challengeAcceptedCount": 1,
            "challengeType": "non-interactive",
            "challengeDescription": "Testing Flashcard Description",
            "photoOnly": false,
            "repeatEveryFormatted": "1 hour",
            "completionIsPrivate": false,
            "commentCount": 0,
            "createdAt": "2018-07-11 18:16:00.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeTypeId": 4,
            "completionCount": 0,
            "repeat": true,
            "id": 1,
            "voteCount": 1,
            "createdAtFormatted": "1 day ago",
            "noPhoto": false
        },
        {
            "challengeImageType": "landscape",
            "challengeImage": "https://gametize.com/somepath/someimage.png",
            "locationOnly": false,
            "challengeTitle": "Test Poll",
            "challengeAcceptedCount": 2,
            "challengeType": "survey",
            "challengeDescription": "Test Poll Description",
            "confirmation": false,
            "photoOnly": false,
            "completionIsPrivate": false,
            "commentCount": 1,
            "points": 0,
            "createdAt": "2018-07-11 18:23:36.0",
            "unlockable": false,
            "completionByAdminOnly": false,
            "challengeTypeId": 11,
            "completionCount": 2,
            "repeat": false,
            "options": [
                {
                    "optionTitle": "Poll 1",
                    "id": 1,
                    "defaultCompletionMessage": "You selected Poll 1"
                }
            ],
            "id": 2,
            "voteCount": 0,
            "createdAtFormatted": "1 day ago",
            "noPhoto": false,
            "multiSelect": false
        }
    ],
    "more": false,
    "topic": {
        "unlockable": false,
        "private": false,
        "id": 1,
        "challengeCount": 4,
        "topicBannerImage": "https://gametize.com/somepath/someimage.png",
        "topicDescription": "Test Topic Description",
        "topicTitle": "Test Topic",
        "topicType": "standard"
    },
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

This endpoint retrieves a list of challenges in the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID/challenges.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.
order optional null id_asc Sorts results by the specified order.
Supported orders:
  • completion_asc (no. of claims, ascending),
  • completion_desc (no. of claims, descending),
  • id_asc (challenge ID, ascending),
  • id_desc (challenge ID descending).

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Completions

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/completions.json",
            "page=2",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/completions.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'2', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/completions.json?page=2&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "challenge": {
                "completionByAdminOnly": false,
                "challengeTypeId": 11,
                "locationOnly": false,
                "challengeTitle": "Test Option",
                "challengeType": "survey",
                "id": 2,
                "confirmation": true,
                "photoOnly": false,
                "completionIsPrivate": false,
                "multiSelect": false
            },
            "id": 2,
            "voteCount": 0,
            "createdAtFormatted": "4 hours ago",
            "userName": "player2",
            "userId": 3,
            "commentCount": 0,
            "points": 20
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "challenge": {
                "completionByAdminOnly": false,
                "challengeTypeId": 11,
                "locationOnly": false,
                "challengeTitle": "Test Poll",
                "challengeType": "survey",
                "id": 1,
                "confirmation": false,
                "photoOnly": false,
                "completionIsPrivate": false,
                "multiSelect": false
            },
            "id": 1,
            "voteCount": 0,
            "createdAtFormatted": "4 hours ago",
            "userName": "player2",
            "userId": 3,
            "commentCount": 0,
            "points": 35
        }
    ],
    "more": false,
    "topic": {
        "unlockable": false,
        "private": false,
        "id": 1,
        "challengeCount": 4,
        "topicBannerImage": "https://gametize.com/somepath/someimage.png",
        "topicDescription": "Test Topic Description",
        "topicTitle": "Test Topic",
        "topicType": "standard"
    },
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

This endpoint retrieves a list of completions for all challenges in the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID/completions.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.
user_id optional 0 2 Get completions in respect to a particular user in the topic.
filter optional null image Filter data based on content type. Available options: image, video.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Users

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/users.json",
            "page=1",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/users.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'1', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/users.json?page=1&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 3,
            "userName": "player2"
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 4,
            "userName": "player3"
        }
    ],
    "more": false
}

This endpoint retrieves a list of users in the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID/users.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Leaderboard

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/leaderboard.json",
            "page=1",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/leaderboard.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'1', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/leaderboard.json?page=1&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 1,
            "id": 2,
            "userName": "player1",
            "points": 40
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 2,
            "id": 3,
            "userName": "player2",
            "points": 30
        }
    ],
    "more": false
}

This endpoint retrieves a list of players on the leaderboard for the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID/leaderboard.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Leaderboard Overview

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/leaderboard_overiew.json",
            "user_id=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/leaderboard_overview.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'user_id':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/leaderboard_overview.json?user_id=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "lowestRank": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "rank": 2,
        "id": 3,
        "userName": "player2",
        "points": 30
    },
    "mainBoard": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 1,
            "id": 2,
            "userName": "player1",
            "points": 40
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 2,
            "id": 3,
            "userName": "player2",
            "points": 30
        }
    ],
    "code": 200,
    "highestRank": {
        "userImage": "https://gametize.com/somepath/someimage.png",
        "rank": 1,
        "id": 2,
        "userName": "player1",
        "points": 40
    }
}

This endpoint retrieves a list of players who provide a leaderboard overview of a quest. Overview types which my be returned include:

  1. A single array of Top 5 users if
    • the user is in the top 5 or,
    • the user has not earned any points.
  2. An array of Top 3 users and an array which includes the user's current position if
    • the user is not in the top 5.

HTTP Request

GET https://gametize.com/api2/topics/ID/leaderboard_overview.json

Parameter(s)

Name Usage Default Example Description
user_id see notes below 0 2 Get the leaderboard overview with respect to a particular user in a topic.
team_id see notes below 0 1 Get the leaderboard overview with respect to a particular team in a topic.
team optional false true Specify if the leaderboard should be filtered by teams. Permitted values: true/false

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identify the user who is viewing the leaderboard overview and is required if the topic or project is private.

This endpoint can be accessed using the "Authorization-Bearer" header when the user is logged-in, and this header is in fact required when attempting to view private projects. However, when viewing a public project, using just the "user_id" or "team_id" will show the specified user's position on the leaderboard along with the top leaderboard players. Setting the "team" parameter to true will return data in a similar format, but with the team leaderboard info.

Topic Achievements

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/achievements.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/achievements.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/achievements.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
            "achievementDescriptionAfter": "Well done!",
            "achievementDescriptionBefore": "Achievement 1",
            "id": 1,
            "achievementName": "Achievement 1",
            "achievementImageSmall": "https://gametize.com/somepath/someimage.png"
        }
    ],
    "more": false
}

This endpoint retrieves the list of achievements to be earned in the specified topic. Another user's ID may be specified if the achievements earned by that user need to be fetched.

HTTP Request

GET https://gametize.com/api2/topics/ID/achievements.json

Parameter(s)

Name Usage Default Example Description
user_id optional 0 2 The user_id of the user whose achievements will be retrieved.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Topic Comments

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/topics/1/comments.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/topics/1/comments.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/topics/1/comments.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "createdAt": {
                "date": 5,
                "hours": 12,
                "seconds": 40,
                "month": 4,
                "nanos": 0,
                "timezoneOffset": -480,
                "year": 118,
                "minutes": 46,
                "time": 1525495600000,
                "day": 6
            },
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 56,
            "createdAtFormatted": "4 hours ago",
            "userName": "player1",
            "commentMessage": "Pretty fun!",
            "userId": 2
        }
    ],
    "more": false
}

This endpoint retrieves the list of comments for the specified topic.

HTTP Request

GET https://gametize.com/api2/topics/ID/comments.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Get data pertaining to you. This includes whether you have earned this item or not.

Challenges

Challenges are the lowest level of categorization for activities on the Gametize platform. There are a wide range of possible activities available to content creators and are identified by challenge type.

Here are the possible challenge types:

The following table specifies the identifiers for the different challenge types:

Name challengeType challengeTypeId
Standard Challenge normal 1
Single-attempt Quiz Challenge quiz 2
Prediction Challenge prediction 3
Flashcard non-interactive 4
Video Challenge video 5
QR Challenge qr 7
Passcode Challenge key 9
Multiple-attempt Quiz Challenge quiz-repeat 10
Poll Challenge survey 11
Multi-Field Challenge multi-field 13
Personality Quiz Challenge personality-quiz 14

When a user completes a challenge, it is referred to as a "claim" or a completion". Completions can vary depending on the challenge type, since it depends on what the user has to submit to complete the challenge. Documentation for performing claims can be found here.

If a challenge is set to have non-private completions, users may view other users' completion activity, which allows them to vote and comment on those users' completions.

Do note that collecting the data from claims, votes, and comments on a challenge can be a rather slow operation if the project has a lot of users/activity.

Challenge Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/challenges/5.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/challenges/5.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/challenges/5.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "challengeImage": "https://gametize.com/somepath/someimage.png",
    "challengeCompleted": false,
    "code": 200,
    "locationOnly": false,
    "challengeAcceptedCount": 1,
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    },
    "challengeDescription": "Testing Flashcard Description",
    "photoOnly": false,
    "repeatEveryFormatted": "1 hour",
    "completionIsPrivate": false,
    "createdAt": "2018-07-11 18:16:00.0",
    "unlockable": false,
    "completionByAdminOnly": false,
    "challengeAccepted": false,
    "completionCount": 0,
    "repeat": true,
    "id": 5,
    "createdAtFormatted": "1 day ago",
    "noPhoto": false,
    "challengeImageType": "landscape",
    "challengeVoted": false,
    "challengeTitle": "Test FlashCard",
    "challengeType": "non-interactive",
    "commentCount": 0,
    "challengeTypeId": 4,
    "topic": {
        "unlockable": false,
        "private": false,
        "id": 1,
        "challengeCount": 4,
        "topicBannerImage": "https://images.gametize.com/Dog.png",
        "topicDescription": "Test Topic Description",
        "topicTitle": "Test Topic",
        "topicType": "standard"
    },
    "voteCount": 1,
    "challengeCompletedBefore": false,
    "challengeBookmarked": false,
    "challengeIdNext": 2
}

This endpoint retrieves the detailed profile of the specific challenge, identified by the challenge ID.

HTTP Request

GET https://gametize.com/api2/challenges/ID.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Challenge Completions


import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/challenges/3/completions.json", 
            "page=2", 
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/challenges/3/completions.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'2', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/challenges/3/completions.json?page=2&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "challenge": {
                "completionByAdminOnly": false,
                "challengeTypeId": 11,
                "locationOnly": false,
                "challengeTitle": "Test Poll",
                "challengeType": "survey",
                "id": 3,
                "confirmation": false,
                "photoOnly": false,
                "completionIsPrivate": false,
                "multiSelect": false
            },
            "id": 4,
            "voteCount": 0,
            "createdAtFormatted": "6 hours ago",
            "userName": "player1",
            "userId": 2,
            "commentCount": 0,
            "points": 30
        }
    ],
    "more": false,
    "topic": {
        "unlockable": false,
        "private": false,
        "id": 1,
        "challengeCount": 4,
        "topicBannerImage": "https://gametize.com/somepath/someimage.png",
        "topicDescription": "Test Topic Description",
        "topicTitle": "Test Topic",
        "topicType": "standard"
    },
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    }
}

In this example, we used the page and limit parameters to show you how they should be used and how the JSON return would look. Doing so also truncates how much data is being fetched, so that this section remains readable (which is similar to why you might use it in your own application).

This endpoint retrieves the list of completions for the specified challenge, filtered by the given parameters.

HTTP Request

GET https://gametize.com/api2/challenges/ID/completions.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specifies which page of results to retrieve.
limit optional 10 5 Specify the number of results to be displayed on each page.
user_id optional 0 2 Filter to get completions from a particular user.
filter optional null image Filter completions based on content type. Available filters: image, video.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Challenge Comments

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/challenges/5/comments.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/challenges/5/comments.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/challenges/5/comments.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "createdAt": {
                "date": 13,
                "hours": 11,
                "seconds": 38,
                "month": 6,
                "nanos": 0,
                "timezoneOffset": -480,
                "year": 118,
                "minutes": 21,
                "time": 1531452098000,
                "day": 5
            },
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 75,
            "createdAtFormatted": "6 hours ago",
            "userName": "player1",
            "commentMessage": "haha",
            "userId": 2
        }
    ],
    "more": false
}

This endpoint retrieves a list of comments on the specified challenge.

HTTP Request

GET https://gametize.com/api2/challenges/ID/comments.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Challenge Leaderboard

Do note that you would rarely need to call the leaderboard API from the challenge level unless your targeted project makes use of it. You may refer to the topic-level or project-level leaderboard API calls if they are more relevant to your application.

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/challenges/5/leaderboard.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/challenges/5/leaderboard.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/challenges/2/leaderboard.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 1,
            "id": 2,
            "userName": "player1",
            "points": 10
        },
        {
            "userImage": "https://gametize.com/somepath/someimage.png",
            "rank": 2,
            "id": 3,
            "userName": "player2",
            "points": 10
        }
    ],
    "more": false
}

Note that the "more" flag indicates if there are more entries in the leaderboard. This can be especially useful if you are using the page and limit parameters and need to know if more pages need to be displayed!

This endpoint retrieves a list of users on the leaderboard of the specified challenge.

HTTP Request

GET https://gametize.com/api2/challenges/ID/leaderboard.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Completions

Completion Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/completions/25.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/completions/25.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/completions/25.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "userImage": "https://gametize.com/somepath/someimage.png",
    "code": 200,
    "challenge": {
        "completionByAdminOnly": false,
        "challengeTypeId": 11,
        "locationOnly": false,
        "challengeTitle": "Test Poll",
        "challengeType": "survey",
        "id": 2,
        "confirmation": true,
        "photoOnly": false,
        "completionIsPrivate": false,
        "multiSelect": false
    },
    "topic": {
        "unlockable": false,
        "private": false,
        "id": 1,
        "challengeCount": 4,
        "topicBannerImage": "https://gametize.com/somepath/someimage.png",
        "topicDescription": "Test Topic Description",
        "topicTitle": "Test Topic",
        "topicType": "standard"
    },
    "project": {
        "projectBannerImage": "https://gametize.com/somepath/someimage.png",
        "private": false,
        "teamEnabled": false,
        "id": 2,
        "searchEnabled": false,
        "guestEnabled": false,
        "projectTitle": "API test project"
    },
    "id": 25,
    "voteCount": 0,
    "createdAtFormatted": "6 hours ago",
    "userName": "player1",
    "userId": 2,
    "commentCount": 0,
    "points": 10
}

This endpoint retrieves the detailed profile of a specific completion.

HTTP Request

GET https://gametize.com/api2/completions/ID.json

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Completion Comments

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/completions/30/comments.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/completions/30/comments.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)
curl -X GET https://gametize.com/api2/completions/30/comments.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "createdAt": {
                "date": 15,
                "hours": 11,
                "seconds": 38,
                "month": 6,
                "nanos": 0,
                "timezoneOffset": -480,
                "year": 118,
                "minutes": 21,
                "time": 1531452098000,
                "day": 5
            },
            "userImage": "https://gametize.com/somepath/someimage.png",
            "id": 89,
            "createdAtFormatted": "4 hours ago",
            "userName": "player1",
            "commentMessage": "done!",
            "userId": 2
        }
    ],
    "more": false
}

This endpoint retrieves a list of comments on the specified completion.

HTTP Request

GET https://gametize.com/api2/completions/ID/comments.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 5 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Notifications

All Notifications

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/notifications.json",
            "page=3",
            "limit=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/notifications.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'page':'3', 'limit':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/notifications.json?page=3&limit=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "data": [
        {
            "createdAt": "2018-07-13 13:15:37.0",
            "photoLarge": "https://gametize.com/somepath/someimage.png",
            "read": false,
            "photoSmall": "https://gametize.com/somepath/someimage.png",
            "id": 1,
            "createdAtFormatted": "15 minutes ago",
            "type": "user",
            "userId": 3,
            "content": "player2 is following your updates"
        }
    ],
    "more": false
}

This endpoint retrieves the list of notifications for the specified user.

HTTP Request

GET https://gametize.com/api2/notifications.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 1 Specify the number of results to be returned on each page.
project_id optional 0 124 Get notifications with respect to a particular project.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Unread Notification Count

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTest {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/notifications/unread.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/notifications/unread.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/notifications/unread.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "notificationUnreadCount": 10
}

This endpoint retrieves the number of unread notifications for the specified user.

HTTP Request

GET https://gametize.com/api2/notifications/unread.json

Parameter(s)

Name Usage Default Example Description
project_id optional 0 124 Get notifications with respect to a particular project.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Rewards

Reward Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/rewards/2.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/rewards/2.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/rewards/2.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns JSON structured like this:

{
    "rewardImageSmall": "https://gametize.com/somepath/someimage.png",
    "quantityAvailable": 99,
    "quantity": 100,
    "code": 200,
    "type": "reward",
    "adminToAward": false,
    "rewardName": "Free badges",
    "createdAt": "2018-07-09 04:58:59.0",
    "ownedQuantityLimit": 5,
    "price": 20,
    "rewardDescription": "Redeem this Free badge!",
    "id": 2,
    "createdAtFormatted": "4 days ago",
    "rewardImageLarge": "https://gametize.com/somepath/someimage.png"
}

This endpoint retrieves the detailed profile of the specified reward.

HTTP Request

GET https://gametize.com/api2/rewards/ID.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 1 1 Specify the number of results to be returned on each page.
user_id optional 0 124 The user_id with respect to whom the reward will be retrieved.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Achievements

Achievement Profile

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/achievements/1.json"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/achievements/1.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}

req = requests.get(url, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/achievements/1.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns JSON structured like this:

{
    "achievementImageLarge": "https://gametize.com/somepath/someimage.png",
    "achievementDescriptionAfter": "Hurray! High three!",
    "createdAt": "2018-05-10 17:23:45.0",
    "code": 200,
    "achievementDescriptionBefore": "Unlock this badge when you complete the challenge",
    "id": 1,
    "createdAtFormatted": "7 minutes ago",
    "achievementName": "Team Huddle",
    "achievementImageSmall": "https://gametize.com/somepath/someimage.png",
    "type": "achievement"
}

This endpoint retrieves the detailed profile of the specified achievement.

HTTP Request

GET https://gametize.com/api2/achievements/ID.json

Parameter(s)

Name Usage Default Example Description
page optional 1 1 Specify which page of results to retrieve.
limit optional 10 1 Specify the number of results to be returned on each page.

Header(s)

Name Usage Default Example Description
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user requesting to view the content.

Actions

Update User

In this example we're just updating the user's country to the US using the code "226". There are several other possible parameters available to you, so include whichever fields you wish to update (all the available options are listed in the parameters table).

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/action/update_user.json", 
            "country_id=226"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/update_user.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'country_id':'226'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/action/update_user.json \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'country_id=226'

The above code returns a JSON object structured like this:

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

This endpoint updates the profile of the specified user.

HTTP Request

POST https://gametize.com/api2/action/update_user.json

Parameter(s)

Name Usage Default Example Description
user_name optional null Someone Cool The user's name.
photo_url optional null http://myprofile.com/image.png The URL to a user's photo. Giving a blank string "" resets the user's photo to the default image. Providing the file and file_name parameters will omit the photo_url.
email optional null someone@gametize.com The user's contact and login email. IMPORTANT NOTE Changing this changes the user's login email.
email_permit optional null 0 Specifies if the user allows receiving emails. Emails are not permitted if the value is 0 and are permitted if it is 1.
device_token optional null If your application has its own Firebase profile, you may use this field to denote the user's device to which push notifications should be sent. Else DO NOT USE THIS PARAMETER.
country_id optional 0 192 Country ID of the user, following international country codes.
telephone optional null +6512345678 Phone number of the user.
file optional null [Image Data] The photo image file for the user profile. Acceptable formats include: png, jpg, gif - Maximum Size: 2MB.
file_name optional null photo.jpg The name of the image file for the user profile - required if the file parameter is included.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Update Password

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/action/update_password.json", 
            "old_password=********", 
            "new_password=********"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/update_password.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'old_password':'********', 'new_password':'********'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/action/update_password.json \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'old_password=********' \
    -d 'new_password=********'

The above code returns a JSON object structured like this:

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

This endpoint allows a user to update their password by supplying the old password and specifying a new one.

HTTP Request

POST http://gametize.com/api2/action/update_password.json

Parameter(s)

Name Usage Default Example Description
old_password required null Passw0rd! The user's old password.
new_password required null N3wPass1! The user's new password.

Follow/Unfollow User

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/follow.json",
            "type_id=3"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/follow.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'3'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/follow.json?type_id=3 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "newFollow": false,
    "userFollowed": true
}

This endpoint follows or unfollows a user for the specified user.

HTTP Request

GET https://gametize.com/api2/action/follow.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the user to be followed/unfollowed.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Unjoin Project

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/unjoin_project.json",
            "type_id=2",
            "user_id=4"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/unjoin_project.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'2', 'user_id':'4'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/unjoin_project.json?type_id=2&user_id=4 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200
}

This endpoint unjoins a project for the specified user.

HTTP Request

GET https://gametize.com/api2/action/unjoin_project.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the project to be unjoined.
user_id required 0 53 The ID of the user to be removed from the project.

Header(s)

Name Usage Default Example Description`
Authorization optional null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Post Comment

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/action/comment.json", 
            "type=completion", 
            "type_id=49",
            "content=Nice!"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/comment.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'type':'completion', 'type_id':'49', 'content':'Nice!'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/action/comment.json \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'type=completion' \
    -d 'type_id=49' \
    -d 'content=Nice!'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "actionPoints": 10,
    "commentCount": 1
}

This endpoint posts a comment on a completion, challenge or topic on behalf of a user. If the project awards points for commenting, the number of points earned from posting the comment is also returned in the JSON object.

HTTP Request

POST https://gametize.com/api2/action/comment.json

Parameter(s)

Name Usage Default Example Description
type required null challenge Acceptable types include: challenge, completion, topic.
type_id required 0 2479 The ID of the challenge, completion or topic being commented on.
content required null "Awesome!" The text content of the comment.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Join Topic

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/join.json",
            "type_id=1"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/join.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'1'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/join.json?type_id=1 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

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

This endpoint joins a topic for the specified user.

HTTP Request

GET https://gametize.com/api2/action/join.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the topic to be joined.

Header(s)

Name Usage Default Example Description`
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Post Comment

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/action/comment.json", 
            "type=completion", 
            "type_id=49",
            "content=Nice!"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/comment.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'type':'completion', 'type_id':'49', 'content':'Nice!'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X POST https://gametize.com/api2/action/comment.json \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'type=completion' \
    -d 'type_id=49' \
    -d 'content=Nice!'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "actionPoints": 10,
    "commentCount": 1
}

This endpoint posts a comment on a completion, challenge or topic on behalf of a user. If the project awards points for commenting, the number of points earned from posting the comment is also returned in the JSON object.

HTTP Request

POST https://gametize.com/api2/action/comment.json

Parameter(s)

Name Usage Default Example Description
type required null challenge Acceptable types include: challenge, completion, topic.
type_id required 0 2479 The ID of the challenge, completion or topic being commented on.
content required null "Awesome!" The text content of the comment.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Like/Unlike

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/vote.json", 
            "type=completion", 
            "type_id=49"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/vote.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type':'completion', 'type_id':'49'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/vote.json?type=completion&type_id=49 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200,
    "voted": true,
    "actionPoints": 1,
    "points": 11,
    "voteCount": 1
}

This endpoint likes or unlikes a challenge, completion, or topic for the specified user.

HTTP Request

GET https://gametize.com/api2/action/vote.json

Parameter(s)

Name Usage Default Example Description
type required null challenge Acceptable types include: challenge, completion, topic.
type_id required 0 2479 The ID of the challenge, completion or topic being voted on.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Accept Challenge

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/accept.json",
        "type_id=12"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/accept.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'12'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/accept.json?type_id=12 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

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

This endpoint accepts a challenge for the specified user.

HTTP Request

GET https://gametize.com/api2/action/accept.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the challenge to be accepted.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Complete Challenge

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "http://gametize.com/api2/action/complete.json", 
            "challenge_id=3", 
            "comment=comment",
            "tweet=false",
            "fb_wallpost=false"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests, json

url = 'https://gametize.com/api2/action/complete.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'challenge_id':'2', 'comment':'comment', 'tweet':'false', 'fb_wallpost':'false'}

r = requests.post(url, data=json.dumps(data), headers=headers)

print(r.text)
curl -X POST https://gametize.com/api/action/complete.json \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Cache-Control: no-cache' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'challenge_id=2' \
    -d 'comment=comment' \
    -d 'tweet=false' \
    -d 'fb_wallpost=false'

The above code returns a JSON object structured like this:

{
    "challengeId": 3,
    "code": 200,
    "completionId": 50,
    "challengeTypeId": 1,
    "expired": false,
    "userChallengeCompletedCount": 3,
    "challengeType": "normal",
    "challengeCount": 4,
    "points": 10
}

This endpoint completes a challenge for a user. For more details on the specific challenge types, please refer here.

HTTP Request

POST https://gametize.com/api2/action/complete.json

Parameter(s)

Standard Challenge

A standard challenge is indicated by challengeType: "normal" or challengeTypeId: 1.

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
comment required 0 My submission is the best! - Must be longer than 5 characters! The description text of the completion to be submitted.
file required if photo-only null [Image Data] The photo image file of the completion to be submitted. Format: png, jpg, gif – Max size: 2MB (1MB or less recommended for reasonable mobile uploading experience.)
file_name required if photo-only null somephoto.jpg The name of the image file being submitted.
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309123 An optional parameter for reference purposes only.
longitude optional null 103.829535456 An optional parameter for reference purposes only.

Quiz/Prediction Challenge

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
quiz_option_id required 0 145 The ID of the quiz or prediction option selected for completion.
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

A quiz challenge is indicated by challengeType: "quiz" or challengeTypeId: 2 while a prediction challenge is indicated by challengeType: "prediction" or challengeTypeId: 3.

QR Challenge

The QR Challenge requires a user to scan a QR Code using an interface provided by the application. The scanned text from the QR code then constitutes one of the input parameters to complete the challenge.

Name Usage Default Example Description
comment required 0 gm://qrchallenge/1234 The plain text deciphered from the QR image - the challenge_id is embedded within the comment parameter in this case.
qr_challenge_id optional null 3 The ID of the QR challenge to be completed.
credits optional null 50 Defines the amount of credits to be awarded to user for completion.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

Poll Challenge

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
quiz_option_id required 0 145 The ID of the quiz or prediction option selected for completion.
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

Confirmation Challenge

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
quiz_option_id required 0 145 The ID of the quiz or prediction option selected for completion.
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

Custom Form/Multi-Field Challenge

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
entries required 0 [{"field_id":1,"field_entry":"value1"},{"field_id":2,"field_entry":"value2"}] A JSON-encoded array of field IDs and field entries
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

Fixed Answer/Passcode Challenge

Name Usage Default Example Description
challenge_id required 0 2479 The ID of the challenge to be completed.
comment required 0 My submission is the best! - Must be longer than 5 characters! The description text of the completion to be submitted.
tweet optional null true An optional parameter for reference purposes only.
fb_wallpost optional null true An optional parameter for reference purposes only.
latitude optional null 1.296309 An optional parameter for reference purposes only.
longitude optional null 103.829535 An optional parameter for reference purposes only.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Add/Remove Bookmark

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/bookmark.json", 
            "type_id=2",
            "flag=true"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/bookmark.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'2', 'flag':'true'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/bookmark.json?type_id=2&flag=true \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

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

This endpoint adds/removes a bookmark from the specified challenge for the specified user.

HTTP Request

GET https://gametize.com/api2/action/bookmark.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the challenge to be joined/left.
flag required true/false true true: add bookmark; false: remove bookmark.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Delete Completion

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/delete_completion.json",
            "type_id=48"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/delete_completion.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'type_id':'48'}

req = requests.post(url, data=data, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/delete_completion.json?type_id=48 \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \

The above code returns a JSON object structured like this:

{
    "code": 200
}

This endpoint deletes a completion for the specified user.

HTTP Request

GET https://gametize.com/api2/action/delete_completion.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the completion to be deleted.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Redeem Reward

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestPost {
    public static void main(String[] args) {
        System.out.println(executePost(
            "https://gametize.com/api2/action/redeem_reward.json", 
            "type_id=2"));
    }

    public static String executePost(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        String paramString = "";
        if (params != null) {
            for (String param : params) {
                paramString += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setDoOutput(true);
            con.setRequestMethod("POST");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Write parameters to the connection
            DataOutputStream output = new DataOutputStream(con.getOutputStream());
            output.writeBytes(paramString);
            output.flush();
            output.close();
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 201) input = con.getInputStream();
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream(); 
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/redeem_reward.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
data = {'type_id':'2'}

req = requests.post(url, data=data, headers=headers)
curl -X POST https://gametize.com/api2/action/redeem_reward.json \
    -H 'Authorization': 'Bearer *-********-****-****-****-************' \
    -H 'Content-Type': 'application/x-www-form-urlencoded' \
    -H 'Cache-Control': 'no-cache' \
    -d 'type_id=2' 

The above code returns a JSON object structured like this:

{
    "code": 200,
    "pointsDeducted": 100,
    "pointsAvailable": 10,
    "transactionId": 3
}

This endpoint redeems a reward available in the project store for the specified user.

HTTP Request

POST https://gametize.com/api2/action/redeem_reward.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 4567 The ID of the reward to be redeemed.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.

Collect Reward

import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

public class ApiTestGet {
    public static void main(String[] args) {
        System.out.println(executeGet("https://gametize.com/api2/action/collect_reward.json",
            "type_id=2"));
    }

    public static String executeGet(String targetURL, String... params) {
        HttpURLConnection con = null;
        // Prepare request URL
        if (params != null) {
            targetURL += "?";
            for (String param : params) {
                targetURL += param + "&";
            }
        }
        try {
            // Attempt a connection to the API server
            URL url = new URL(targetURL);
            con = (HttpURLConnection) url.openConnection();
            con.setRequestMethod("GET");
            // Add header fields
            con.setRequestProperty("Cache-Control", "no-cache");
            con.setRequestProperty("Accept", "application/json");
            con.setRequestProperty("Content-Type", "application/json");
            con.setRequestProperty("Authorization", "Bearer *-********-****-****-****-************");
            con.setUseCaches(false);
            // Get response
            InputStream input;
            // If success code is returned, use InputStream
            if (con.getResponseCode() == 200) input = con.getInputStream(); 
            // If error code is returned, check ErrorStream instead
            else input = con.getErrorStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(input));
            StringBuffer response = new StringBuffer();
            while (reader.ready()) response.append(reader.readLine());
            reader.close();
            return response.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            if (con != null) {
                con.disconnect();
            }
        }
    }
}
import requests

url = 'https://gametize.com/api2/action/collect_reward.json'
headers = {'Content-Type':'application/x-www-form-urlencoded', 'Cache-Control':'no-cache', \
'Accept':'application/json', 'Authorization':'Bearer *-********-****-****-****-************'}
params = {'type_id':'2'}

req = requests.get(url, params=params, headers=headers)

print(req.text)
curl -X GET https://gametize.com/api2/action/collect_reward.json?type_id=2 \
    -H 'Authorization: Bearer *-********-****-****-****-************' \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -H 'Cache-Control: no-cache'

The above code returns a JSON object structured like this:

{
    "code": 200
}

This endpoint marks a reward as collected for the specified user.

HTTP Request

GET https://gametize.com/api2/action/collect_reward.json

Parameter(s)

Name Usage Default Example Description
type_id required 0 2479 The ID of the item to be used - reward needs to have been redeemed by the user.

Header(s)

Name Usage Default Example Description
Authorization required null Bearer 2073-02fde5e7-097a-4971-a4d4-de7154113ed7 Identifies the user performing the action.