Service: CreateCategory

The CreateCategory service allows you to create new categories within Flexmail. The ID of the newly created category will be returned to you.

Service Details

SOAP Action: CreateCategory
SOAP Return Object: CreateCategoryResp

Input

The following table describes the parameters used for calling the CreateCategory service.

Table: instance of CreateCategoryReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
categoryName Y String Name of the new category

Output

The following table describes the parameters returned from the CreateCategory service.

Table: instance of CreateCategoryResp

Parameter Mandatory Type Description
categoryId / Integer Id of the new category
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error
header / APIResponseHeader Header containing authentication information

Table: response codes of CreateCategoryResp.

0 No error
220 Authentication error, see header object for detailed information
221 Category name is mandatory
222 Category already exists

Example

This example shows you the creation of a category entitled "My new category".

<?php
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;
$createCategoryReq->header = $header;
$createCategoryReq->categoryName = "My new category";
$createCategoryResp = $SoapClient->__soapCall("CreateCategory",
					array( $createCategoryReq ));

if ($createCategoryResp->errorCode == 0) {
	echo "Category created, category ID: " . $createCategoryResp->categoryId;
} else {
	echo "Category creation failed: " . $createCategoryResp->errorMessage;
}
?>