Add a Cost Center

Resource URL
/moservices/rest/api/ipass/{COMPANY_ID}/mo/costcenter
HTTP POST

Add a Cost Center.

POST Parameters
Parameter Value Description
COMPANY_ID Your companyId can be found in the Open Mobile Portal.Mandatory
actioncreateCostCenterMandatory
User-AgentapiuserMandatory. This helps us route your API call appropriately.
Sample XML Payload
<costcenter>
   <name>Finance Department</name>
   <costId>Finance</costId>
   <assignedCount />
   <childCompany />
</costcenter>
Parameter Description
name Mandatory
costId Mandatory
childCompanyOptional. The ID of the child companies (if Cost Center is enabled with the support of Child Companies).

Examples

In this example, a Cost Center named “Finance Department” will be created under the Acme company (ID 987654).

cURL:
curl -k --request POST -b tmpCookies.txt -d input.xml -H “Content-Type: text/xml” "https://openmobile.ipass.com/moservices/rest/api/ipass/987654/mo/costcenter?action=createCostCenter&User-Agent=apiuser"
The input.xml contains the XML Payload.
Java:
String reportURI = "/moservices/rest/api/ipass/" + companyId + "/mo/costcenter?action=createCostCenter&User-Agent=apiuser";
HttpPost reportPost = new HttpPost(BASE_URL + reportURI);
				
StringBuffer result = new StringBuffer();
result.append("<costcenter>\n");
result.append("<name>").append(costCenterName).append("</name>\n");
result.append("<costId>").append(costCenterId).append("</costId>\n");
result.append("<assignedCount>").append("").append("</assignedCount>\n");
result.append("<childCompany>").append("").append("</childCompany>\n");
result.append("</costcenter>\n");

StringEntity entity = new StringEntity(result, "text/xml", HTTP.DEFAULT_CONTENT_CHARSET);
reportPost.setEntity(entity);

HttpResponse postResponse = httpClient.execute(reportPost);

Go to: REST API Overview > Manage Cost Center

 

©2015 iPass Inc. All rights reserved. Terms of Use