countmatic api

Counter

addCounter

Add another counter for your access token, this makes it a so called "grouptoken"


/counter/add

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/add?token=&name=&initialvalue="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | The name of the counter
        Long initialvalue = 789; // Long | Initial value for the counter, default is 0
        try {
            Counter result = apiInstance.addCounter(token, name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#addCounter");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | The name of the counter
        Long initialvalue = 789; // Long | Initial value for the counter, default is 0
        try {
            Counter result = apiInstance.addCounter(token, name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#addCounter");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // The name of the counter
Long *initialvalue = 789; // Initial value for the counter, default is 0 (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Add another counter for your access token, this makes it a so called "grouptoken"
[apiInstance addCounterWith:token
    name:name
    initialvalue:initialvalue
              completionHandler: ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var name = name_example; // {String} The name of the counter

var opts = { 
  'initialvalue': 789 // {Long} Initial value for the counter, default is 0
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.addCounter(token, name, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class addCounterExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | The name of the counter
            var initialvalue = 789;  // Long | Initial value for the counter, default is 0 (optional) 

            try
            {
                // Add another counter for your access token, this makes it a so called "grouptoken"
                Counter result = apiInstance.addCounter(token, name, initialvalue);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.addCounter: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | The name of the counter
$initialvalue = 789; // Long | Initial value for the counter, default is 0

try {
    $result = $api_instance->addCounter($token, $name, $initialvalue);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->addCounter: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | The name of the counter
my $initialvalue = 789; # Long | Initial value for the counter, default is 0

eval { 
    my $result = $api_instance->addCounter(token => $token, name => $name, initialvalue => $initialvalue);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->addCounter: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | The name of the counter
initialvalue = 789 # Long | Initial value for the counter, default is 0 (optional)

try: 
    # Add another counter for your access token, this makes it a so called "grouptoken"
    api_response = api_instance.add_counter(token, name, initialvalue=initialvalue)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->addCounter: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name*
String
The name of the counter
Required
initialvalue
Long (int64)
Initial value for the counter, default is 0

Responses

Status: 200 - OK, counter created and added to token

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


deleteCounter

Delete that counter without a trace


/counter/delete

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/delete?token=&name="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        try {
            Counter result = apiInstance.deleteCounter(token, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#deleteCounter");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        try {
            Counter result = apiInstance.deleteCounter(token, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#deleteCounter");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // Optionally the name of the requested counter, mandatory for grouptokens (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Delete that counter without a trace
[apiInstance deleteCounterWith:token
    name:name
              completionHandler: ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var opts = { 
  'name': name_example // {String} Optionally the name of the requested counter, mandatory for grouptokens
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.deleteCounter(token, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class deleteCounterExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | Optionally the name of the requested counter, mandatory for grouptokens (optional) 

            try
            {
                // Delete that counter without a trace
                Counter result = apiInstance.deleteCounter(token, name);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.deleteCounter: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens

try {
    $result = $api_instance->deleteCounter($token, $name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->deleteCounter: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | Optionally the name of the requested counter, mandatory for grouptokens

eval { 
    my $result = $api_instance->deleteCounter(token => $token, name => $name);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->deleteCounter: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | Optionally the name of the requested counter, mandatory for grouptokens (optional)

try: 
    # Delete that counter without a trace
    api_response = api_instance.delete_counter(token, name=name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->deleteCounter: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name
String
Optionally the name of the requested counter, mandatory for grouptokens

Responses

Status: 200 - OK, counter deleted

Status: 400 - Got grouptoken without specified name

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


getCurrentReading

Get current reading of the counters for that token


/counter/current

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/current?token=&name="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter
        try {
            Counters result = apiInstance.getCurrentReading(token, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getCurrentReading");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter
        try {
            Counters result = apiInstance.getCurrentReading(token, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getCurrentReading");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // Optionally the name of the requested counter (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Get current reading of the counters for that token
[apiInstance getCurrentReadingWith:token
    name:name
              completionHandler: ^(Counters output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var opts = { 
  'name': name_example // {String} Optionally the name of the requested counter
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getCurrentReading(token, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getCurrentReadingExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | Optionally the name of the requested counter (optional) 

            try
            {
                // Get current reading of the counters for that token
                Counters result = apiInstance.getCurrentReading(token, name);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.getCurrentReading: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | Optionally the name of the requested counter

try {
    $result = $api_instance->getCurrentReading($token, $name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->getCurrentReading: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | Optionally the name of the requested counter

eval { 
    my $result = $api_instance->getCurrentReading(token => $token, name => $name);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->getCurrentReading: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | Optionally the name of the requested counter (optional)

try: 
    # Get current reading of the counters for that token
    api_response = api_instance.get_current_reading(token, name=name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->getCurrentReading: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name
String
Optionally the name of the requested counter

Responses

Status: 200 - OK, counter read

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


getNewCounter

Create new counter and retrieve an access token for it. All counters and tokens have a default TTL of one week. That means, that all data is removed automatically after one week of "uselessness".


/counter/new

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/new?name=&initialvalue="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String name = name_example; // String | The name of the counter
        Long initialvalue = 789; // Long | Initial value for the counter, default is 0
        try {
            Token result = apiInstance.getNewCounter(name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getNewCounter");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String name = name_example; // String | The name of the counter
        Long initialvalue = 789; // Long | Initial value for the counter, default is 0
        try {
            Token result = apiInstance.getNewCounter(name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getNewCounter");
            e.printStackTrace();
        }
    }
}
String *name = name_example; // The name of the counter
Long *initialvalue = 789; // Initial value for the counter, default is 0 (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Create new counter and retrieve an access token for it. All counters and tokens have a default TTL of one week. That means, that all data is removed automatically after one week of "uselessness".
[apiInstance getNewCounterWith:name
    initialvalue:initialvalue
              completionHandler: ^(Token output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var name = name_example; // {String} The name of the counter

var opts = { 
  'initialvalue': 789 // {Long} Initial value for the counter, default is 0
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getNewCounter(name, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getNewCounterExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var name = name_example;  // String | The name of the counter
            var initialvalue = 789;  // Long | Initial value for the counter, default is 0 (optional) 

            try
            {
                // Create new counter and retrieve an access token for it. All counters and tokens have a default TTL of one week. That means, that all data is removed automatically after one week of "uselessness".
                Token result = apiInstance.getNewCounter(name, initialvalue);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.getNewCounter: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$name = name_example; // String | The name of the counter
$initialvalue = 789; // Long | Initial value for the counter, default is 0

try {
    $result = $api_instance->getNewCounter($name, $initialvalue);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->getNewCounter: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $name = name_example; # String | The name of the counter
my $initialvalue = 789; # Long | Initial value for the counter, default is 0

eval { 
    my $result = $api_instance->getNewCounter(name => $name, initialvalue => $initialvalue);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->getNewCounter: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
name = name_example # String | The name of the counter
initialvalue = 789 # Long | Initial value for the counter, default is 0 (optional)

try: 
    # Create new counter and retrieve an access token for it. All counters and tokens have a default TTL of one week. That means, that all data is removed automatically after one week of "uselessness".
    api_response = api_instance.get_new_counter(name, initialvalue=initialvalue)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->getNewCounter: %s\n" % e)

Parameters

Query parameters
Name Description
name*
String
The name of the counter
Required
initialvalue
Long (int64)
Initial value for the counter, default is 0

Responses

Status: 200 - OK, counter created

Status: default - unexpected error


getReadOnlyToken

Request read-only access token for that token


/counter/readonly

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/readonly?token="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        try {
            Token result = apiInstance.getReadOnlyToken(token);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getReadOnlyToken");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        try {
            Token result = apiInstance.getReadOnlyToken(token);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#getReadOnlyToken");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token

CounterApi *apiInstance = [[CounterApi alloc] init];

// Request read-only access token for that token
[apiInstance getReadOnlyTokenWith:token
              completionHandler: ^(Token output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getReadOnlyToken(token, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getReadOnlyTokenExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token

            try
            {
                // Request read-only access token for that token
                Token result = apiInstance.getReadOnlyToken(token);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.getReadOnlyToken: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token

try {
    $result = $api_instance->getReadOnlyToken($token);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->getReadOnlyToken: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token

eval { 
    my $result = $api_instance->getReadOnlyToken(token => $token);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->getReadOnlyToken: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token

try: 
    # Request read-only access token for that token
    api_response = api_instance.get_read_only_token(token)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->getReadOnlyToken: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required

Responses

Status: 200 - OK, read-only token created

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


nextNumber

Increment and get current reading of that counter


/counter/next

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/next?token=&name=&increment="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long increment = 789; // Long | Value to add to the current counter's value, default is 1
        try {
            Counter result = apiInstance.nextNumber(token, name, increment);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#nextNumber");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long increment = 789; // Long | Value to add to the current counter's value, default is 1
        try {
            Counter result = apiInstance.nextNumber(token, name, increment);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#nextNumber");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // Optionally the name of the requested counter, mandatory for grouptokens (optional)
Long *increment = 789; // Value to add to the current counter's value, default is 1 (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Increment and get current reading of that counter
[apiInstance nextNumberWith:token
    name:name
    increment:increment
              completionHandler: ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var opts = { 
  'name': name_example, // {String} Optionally the name of the requested counter, mandatory for grouptokens
  'increment': 789 // {Long} Value to add to the current counter's value, default is 1
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.nextNumber(token, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class nextNumberExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | Optionally the name of the requested counter, mandatory for grouptokens (optional) 
            var increment = 789;  // Long | Value to add to the current counter's value, default is 1 (optional) 

            try
            {
                // Increment and get current reading of that counter
                Counter result = apiInstance.nextNumber(token, name, increment);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.nextNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
$increment = 789; // Long | Value to add to the current counter's value, default is 1

try {
    $result = $api_instance->nextNumber($token, $name, $increment);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->nextNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | Optionally the name of the requested counter, mandatory for grouptokens
my $increment = 789; # Long | Value to add to the current counter's value, default is 1

eval { 
    my $result = $api_instance->nextNumber(token => $token, name => $name, increment => $increment);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->nextNumber: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | Optionally the name of the requested counter, mandatory for grouptokens (optional)
increment = 789 # Long | Value to add to the current counter's value, default is 1 (optional)

try: 
    # Increment and get current reading of that counter
    api_response = api_instance.next_number(token, name=name, increment=increment)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->nextNumber: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name
String
Optionally the name of the requested counter, mandatory for grouptokens
increment
Long (int64)
Value to add to the current counter's value, default is 1

Responses

Status: 200 - OK, counter incremented

Status: 400 - Got grouptoken without specified name

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


previousNumber

Decrement and get current reading of that counter


/counter/previous

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/previous?token=&name=&decrement="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long decrement = 789; // Long | Value to substract from the counter's current value, default is 1
        try {
            Counter result = apiInstance.previousNumber(token, name, decrement);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#previousNumber");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long decrement = 789; // Long | Value to substract from the counter's current value, default is 1
        try {
            Counter result = apiInstance.previousNumber(token, name, decrement);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#previousNumber");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // Optionally the name of the requested counter, mandatory for grouptokens (optional)
Long *decrement = 789; // Value to substract from the counter's current value, default is 1 (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Decrement and get current reading of that counter
[apiInstance previousNumberWith:token
    name:name
    decrement:decrement
              completionHandler: ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var opts = { 
  'name': name_example, // {String} Optionally the name of the requested counter, mandatory for grouptokens
  'decrement': 789 // {Long} Value to substract from the counter's current value, default is 1
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.previousNumber(token, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class previousNumberExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | Optionally the name of the requested counter, mandatory for grouptokens (optional) 
            var decrement = 789;  // Long | Value to substract from the counter's current value, default is 1 (optional) 

            try
            {
                // Decrement and get current reading of that counter
                Counter result = apiInstance.previousNumber(token, name, decrement);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.previousNumber: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
$decrement = 789; // Long | Value to substract from the counter's current value, default is 1

try {
    $result = $api_instance->previousNumber($token, $name, $decrement);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->previousNumber: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | Optionally the name of the requested counter, mandatory for grouptokens
my $decrement = 789; # Long | Value to substract from the counter's current value, default is 1

eval { 
    my $result = $api_instance->previousNumber(token => $token, name => $name, decrement => $decrement);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->previousNumber: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | Optionally the name of the requested counter, mandatory for grouptokens (optional)
decrement = 789 # Long | Value to substract from the counter's current value, default is 1 (optional)

try: 
    # Decrement and get current reading of that counter
    api_response = api_instance.previous_number(token, name=name, decrement=decrement)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->previousNumber: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name
String
Optionally the name of the requested counter, mandatory for grouptokens
decrement
Long (int64)
Value to substract from the counter's current value, default is 1

Responses

Status: 200 - OK, counter decremented

Status: 400 - Got grouptoken without specified name

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


resetCounter

Reset that counter


/counter/reset

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/counter/reset?token=&name=&initialvalue="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CounterApi;

import java.io.File;
import java.util.*;

public class CounterApiExample {

    public static void main(String[] args) {
        
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long initialvalue = 789; // Long | New value for the counter, default is 1
        try {
            Counter result = apiInstance.resetCounter(token, name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#resetCounter");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.CounterApi;

public class CounterApiExample {

    public static void main(String[] args) {
        CounterApi apiInstance = new CounterApi();
        String token = token_example; // String | Your access token
        String name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
        Long initialvalue = 789; // Long | New value for the counter, default is 1
        try {
            Counter result = apiInstance.resetCounter(token, name, initialvalue);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CounterApi#resetCounter");
            e.printStackTrace();
        }
    }
}
String *token = token_example; // Your access token
String *name = name_example; // Optionally the name of the requested counter, mandatory for grouptokens (optional)
Long *initialvalue = 789; // New value for the counter, default is 1 (optional)

CounterApi *apiInstance = [[CounterApi alloc] init];

// Reset that counter
[apiInstance resetCounterWith:token
    name:name
    initialvalue:initialvalue
              completionHandler: ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.CounterApi()

var token = token_example; // {String} Your access token

var opts = { 
  'name': name_example, // {String} Optionally the name of the requested counter, mandatory for grouptokens
  'initialvalue': 789 // {Long} New value for the counter, default is 1
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.resetCounter(token, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class resetCounterExample
    {
        public void main()
        {
            
            var apiInstance = new CounterApi();
            var token = token_example;  // String | Your access token
            var name = name_example;  // String | Optionally the name of the requested counter, mandatory for grouptokens (optional) 
            var initialvalue = 789;  // Long | New value for the counter, default is 1 (optional) 

            try
            {
                // Reset that counter
                Counter result = apiInstance.resetCounter(token, name, initialvalue);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CounterApi.resetCounter: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\CounterApi();
$token = token_example; // String | Your access token
$name = name_example; // String | Optionally the name of the requested counter, mandatory for grouptokens
$initialvalue = 789; // Long | New value for the counter, default is 1

try {
    $result = $api_instance->resetCounter($token, $name, $initialvalue);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CounterApi->resetCounter: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CounterApi;

my $api_instance = WWW::SwaggerClient::CounterApi->new();
my $token = token_example; # String | Your access token
my $name = name_example; # String | Optionally the name of the requested counter, mandatory for grouptokens
my $initialvalue = 789; # Long | New value for the counter, default is 1

eval { 
    my $result = $api_instance->resetCounter(token => $token, name => $name, initialvalue => $initialvalue);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CounterApi->resetCounter: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CounterApi()
token = token_example # String | Your access token
name = name_example # String | Optionally the name of the requested counter, mandatory for grouptokens (optional)
initialvalue = 789 # Long | New value for the counter, default is 1 (optional)

try: 
    # Reset that counter
    api_response = api_instance.reset_counter(token, name=name, initialvalue=initialvalue)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CounterApi->resetCounter: %s\n" % e)

Parameters

Query parameters
Name Description
token*
String
Your access token
Required
name
String
Optionally the name of the requested counter, mandatory for grouptokens
initialvalue
Long (int64)
New value for the counter, default is 1

Responses

Status: 200 - OK, counter reset

Status: 400 - Got grouptoken without specified name

Status: 403 - Forbidden, action not allowed with that token

Status: 404 - Not Found, unknown token

Status: default - unexpected error


Stats

getNumberOfCounters

Request the number of currently open counters on that countmatic backend


/stats/counters

Usage and SDK Samples

curl -X GET "https://api.countmatic.io/v1/stats/counters"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.StatsApi;

import java.io.File;
import java.util.*;

public class StatsApiExample {

    public static void main(String[] args) {
        
        StatsApi apiInstance = new StatsApi();
        try {
            Counter result = apiInstance.getNumberOfCounters();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling StatsApi#getNumberOfCounters");
            e.printStackTrace();
        }
    }
}
import io.swagger.client.api.StatsApi;

public class StatsApiExample {

    public static void main(String[] args) {
        StatsApi apiInstance = new StatsApi();
        try {
            Counter result = apiInstance.getNumberOfCounters();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling StatsApi#getNumberOfCounters");
            e.printStackTrace();
        }
    }
}

StatsApi *apiInstance = [[StatsApi alloc] init];

// Request the number of currently open counters on that countmatic backend
[apiInstance getNumberOfCountersWithCompletionHandler: 
              ^(Counter output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
var CountmaticApi = require('countmatic_api');

var api = new CountmaticApi.StatsApi()

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getNumberOfCounters(callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getNumberOfCountersExample
    {
        public void main()
        {
            
            var apiInstance = new StatsApi();

            try
            {
                // Request the number of currently open counters on that countmatic backend
                Counter result = apiInstance.getNumberOfCounters();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling StatsApi.getNumberOfCounters: " + e.Message );
            }
        }
    }
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\StatsApi();

try {
    $result = $api_instance->getNumberOfCounters();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling StatsApi->getNumberOfCounters: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::StatsApi;

my $api_instance = WWW::SwaggerClient::StatsApi->new();

eval { 
    my $result = $api_instance->getNumberOfCounters();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling StatsApi->getNumberOfCounters: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.StatsApi()

try: 
    # Request the number of currently open counters on that countmatic backend
    api_response = api_instance.get_number_of_counters()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling StatsApi->getNumberOfCounters: %s\n" % e)

Parameters

Responses

Status: 200 - OK, number of counters returned

Status: default - unexpected error


Generated 2017-10-30T12:53:19.848+01:00