Authentication: Token Validation

This endpoint accepts an access token string and a POOL User ID as POST arguments and returns whether or not that access token is still valid for POOL API calls.

Token Validation Specifications:

Parameters: POST variables:
  1. userid: integer
  2. token: string
Header variables:
  1. None
Data Returned:

Validation Work Flow

  1. URL: https://api.promoonly.com/user/token/validate
  2. Header: none
  3. Method: POST
  4. POST Variables:
  5. Returned: JSON

    Example JSON Output:

    {
        "token": "valid"
    }
    - OR -
    {
        "token": "invalid"
    }

Examples

  1. PHP (using cURL):

    <?php
        $post_fields = "userid=1&token=8b26e1e4f3f5e00a888807e605565c47";
        $validation_url = "https://api.promoonly.com/user/token/validate";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $validation_url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $validation_result = curl_exec($ch);
        curl_close($ch);

        $result_obj = json_decode($validation_result);
    ?>
  2. Javascript (using jQuery):

    $.ajax({
        type: "POST",
        url: "https://api.promoonly.com/user/token/validate",
        data: { userid: 1, token: "8b26e1e4f3f5e00a888807e605565c47" },
        dataType: "json",
        success: function (data)
        {
            console.log(data);
        }
    });
  3. Python (using requests):

    #!/usr/bin/env python

    import requests
    import urllib

    user_data = { "userid": 1, "token": "8b26e1e4f3f5e00a888807e605565c47" }
    validate_url = "https://api.promoonly.com/user/token/validate"
    validation_result = requests.post(validate_url, data=user_data)

    print(validation_result.text)