Sub Categories
Sub categories represent the event sub topics.
A sub category is part of the events module and provides the folowing information:
- priority
- introduction
- id
- title
Getting Sub Categories
GET (/api/v2/event/sub_categories/:id()
statuscode 200
no error
statuscode 404
does not exist
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories/4 -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_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/sub_categories/4',
auth=('<username>', '<password>'))
print response.json
Example response:
{
"priority": 256,
"introduction": null,
"id": 4,
"title": "My course sub-category"
}
Getting more than one Sub Category
GET (/api/v2/event/sub_categories()
statuscode 200
no error
statuscode 404
does not exist
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_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/sub_categories',
auth=('<username>', '<password>'))
print response.json
Example response:
[
{
"priority": 256,
"introduction": null,
"id": 2,
"title": "My course sub-category"
},
{
"priority": 1256,
"introduction": null,
"id": 3,
"title": "My other course sub-category"
}
]
Filtering
The results for a list of contacts can be filtered. See Filtering
Creating Sub Categories
POST (/api/v2/event/sub_categories()
Required fields:
- priority
- parent_category_id
- title
statuscode 200
no error
statuscode 404
could not create
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories -H "Content-Type: application/json" -k -u (login):(password) -X POST -d '{"priority": 256, "parent_category_id": 1, "title": "My course sub-category"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories';
$data = array("priority" => 256, "title" => u'My course sub-category', "parent_category_id" => 1);
$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'title': u'My course sub-category', u'parent_category_id': 1}
response = requests.post('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories',
data=json.dumps(data),
headers={'content-type': 'application/json'},
auth=('<username>', '<password>'))
print response.json
Example response:
{
"priority": 256,
"introduction": null,
"id": 4,
"title": "My course sub-category"
}
Updating Sub Categories
PUT (/api/v2/event/sub_categories/(int: id)
statuscode 200
no error
statuscode 404
does not exist
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories/6 -H "Content-Type: application/json" -k -u (login):(password) -X PUT -d '{"title": "My new value for title"}'
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories/6';
$data = array("title" => u'My new value for title');
$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'title': u'My new value for title'}
response = requests.put('http://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories/6',
data=json.dumps(data),
headers={'content-type': 'application/json'},
auth=('<username>', '<password>'))
print response.json
Example response:
{
"priority": 256,
"introduction": null,
"id": 6,
"title": "My new value for title"
}
Deleting Sub Categories
DELETE (/api/v2/event/sub_categories/(int: id)
statuscode 200
deleted entity successfully
statuscode 404
entity not found
Using Curl:
curl https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_categories/1 -X DELETE -k -u (login):(password)
Using PHP:
<?php
$credentials = '(username):(password)';
$url = 'https://YOUR-SUBDOMAIN.administrateapp.com/api/v2/event/sub_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/sub_categories/1',
auth=('<username>', '<password>'))
print response.json
Example response:
{
"priority": 256,
"introduction": null,
"id": 1,
"title": "My course sub-category"
}