The CreateCategory service allows you to create new categories within Flexmail. The ID of the newly created category will be returned to you.
SOAP Action: CreateCategory
SOAP Return Object: CreateCategoryResp
The following table describes the parameters used for calling the CreateCategory service.
Parameter | Mandatory | Type | Description |
---|---|---|---|
header | Y | APIRequestHeader | Header for authentication |
categoryName | Y | String | Name of the new category |
The following table describes the parameters returned from the CreateCategory service.
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 |
0 | No error |
---|---|
220 | Authentication error, see header object for detailed information |
221 | Category name is mandatory |
222 | Category already exists |
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; } ?>