Categories

Categories represent the event topics.

A category is part of the events module and provides the folowing information:

  • introduction
  • sub_categories
  • id
  • name

Getting Categories

GET (/api/v2/event/categories/:id()

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/4     -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/4';
$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

Using Python:

import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/4',
                         auth=('<username>', '<password>'))

print response.json

Example response:

{
    "introduction": null,
    "sub_categories": [],
    "id": 4,
    "name": "My course category"
}

Getting more than one Category

GET (/api/v2/event/categories()

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories     -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories';
$options = array(
  'http' => array(
    'method'  => 'GET',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

Using Python:

import json
import requests

response = requests.get('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories',
                         auth=('<username>', '<password>'))

print response.json

Example response:

[
    {
        "introduction": null,
        "sub_categories": [],
        "id": 2,
        "name": "My course category"
    },
    {
        "introduction": null,
        "sub_categories": [],
        "id": 3,
        "name": "My other course category"
    }
]

Filtering

The results for a list of contacts can be filtered. See Filtering

Creating Categories

POST (/api/v2/event/categories()

Required fields:

  • priority
  • name
  • statuscode 200

    no error

  • statuscode 404

    could not create

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories     -H "Content-Type: application/json"     -k -u (login):(password)     -X POST     -d '{"priority": 256, "name": "My course category"}'

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories';
$data = array("priority" => 256, "name" => u'My course category');
$options = array(
'http' => array(
'method'  => 'POST',
'content' => json_encode($data),
'header'=>  "Content-Type: application/json\r\n" .
            "Accept: application/json\r\n" .
            "Authorization: Basic " . base64_encode($credentials)
)
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

Using Python:

import json
import requests

data = {u'priority': 256, u'name': u'My course category'}

response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories',
                        data=json.dumps(data),
                        headers={'content-type': 'application/json'},
                        auth=('<username>', '<password>'))

print response.json

Example response:

{
    "introduction": null,
    "sub_categories": [],
    "id": 4,
    "name": "My course category"
}

Updating Categories

PUT (/api/v2/event/categories/(int: id)

  • statuscode 200

    no error

  • statuscode 404

    does not exist

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/6     -H "Content-Type: application/json"     -k -u (login):(password)     -X PUT     -d '{"name": "My new value for name"}'

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/6';
$data = array("name" => u'My new value for name');
$options = array(
'http' => array(
'method'  => 'PUT',
'content' => json_encode($data),
'header'=>  "Content-Type: application/json\r\n" .
            "Accept: application/json\r\n" .
            "Authorization: Basic " . base64_encode($credentials)
)
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

Using Python:

import json
import requests

data = {u'name': u'My new value for name'}

response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/6',
                        data=json.dumps(data),
                        headers={'content-type': 'application/json'},
                        auth=('<username>', '<password>'))

print response.json

Example response:

{
    "introduction": null,
    "sub_categories": [],
    "id": 6,
    "name": "My new value for name"
}

Deleting Categories

DELETE (/api/v2/event/categories/(int: id)

  • statuscode 200

    deleted entity successfully

  • statuscode 404

    entity not found

Using Curl:

curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/1     -X DELETE -k -u (login):(password)

Using PHP:

<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/1';
$options = array(
  'http' => array(
    'method'  => 'DELETE',
    'header'=>  "Accept: application/json\r\n" .
                "Authorization: Basic " . base64_encode($credentials)
    )
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;

Using Python:

import json
import requests

response = requests.delete('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/categories/1',
                         auth=('<username>', '<password>'))

print response.json

Example response:

{
    "introduction": null,
    "sub_categories": [],
    "id": 1,
    "name": "My course category"
}