hoangweb
3/18/2018 - 2:40 AM

mautic category

<?php
$categoryApi = $api->newApi("categories", $auth, $apiUrl);

//get an category
$category = $categoryApi->get($id);

//Returns a list of contact categories available to the user
$categories = $categoryApi->getList($searchFilter, $start, $limit, $orderBy, $orderByDir, $publishedOnly, $minimal);

//create new category
$data = array(
    'categoryname' => 'test',
    'categoryemail' => 'test@category.com',
    'categorycity' => 'Raleigh',
);

$category = $categoryApi->create($data);

//edit a category
$id   = 1;
$data = array(
    'title' => 'test',
    'bundle' => 'asset'
);

// Create new a category of ID 1 is not found?
$createIfNotFound = true;

$category = $categoryApi->edit($id, $data, $createIfNotFound);

//delete a category
$category = $categoryApi->delete($id);