Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
update_cost_center [2014/06/24 16:42]
ybarajas [Update a Cost Center]
update_cost_center [2014/06/24 16:58] (current)
ybarajas
Line 1: Line 1:
 +======Update a Cost Center======
  
 +
 +
 +==Resource URL==
 +
 +<​code>​
 +/​moservices/​rest/​api/​ipass/​{COMPANY_ID}/​mo/​costcenter
 +</​code>​
 +
 +==HTTP POST==
 +Update a Cost Center'​s information.
 +
 +==POST Parameters==
 +
 +^ Parameter ^ Value ^ Description ^
 +|Company_ID|Your companyId can be found in the Open Mobile Portal.|Mandatory|
 +|action| UpdateCostCenter| Mandatory|
 +|User-Agent|apiuser|Mandatory. This helps us route your API call appropriately.|
 +
 +==Sample XML Payload==
 +
 +<​code>​
 +<​costcenter>​
 +   <​name>​Finance Department</​name>​
 +   <​costId>​Finance</​costId>​
 +   <​childCompany />
 +   <​id>​123456</​id>​
 +</​costcenter>​
 +</​code>​
 +
 +^ Parameter ^ Description ^
 +|id|Mandatory. The unique identifier associated with the Cost Center.|
 +|name| Mandatory. The name of the Cost Center.|
 +|costId|Mandatory. The ID of the Cost Center.|
 +|childCompany|Optional. The ID of the child companies (if Cost Center is enabled with the support of Child Companies).|
 +
 +
 +=====Examples=====
 +
 +In this example, the Cost Center (ID 123456), which is under the Acme Company (ID 987654), is being updated with a new name. The new name will be "​Finance UK" and CostCenterID will be "​Finance UK".
 +
 +
 +
 +==cURL:==
 +
 +<​code>​
 +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=updateCostCenter&​User-Agent=apiuser"​
 +</​code>​
 +
 +<​note>​ The **input.xml** contains the **XML Payload**.</​note>​
 +
 +==Java:==
 +
 +<​code>​
 +String reportURI = "/​moservices/​rest/​api/​ipass/"​ + companyId + "/​mo/​costcenter?​action=updateCostCenter&​User-Agent=apiuser";​
 +HttpPost reportPost = new HttpPost(BASE_URL + reportURI);
 +
 +StringBuffer result = new StringBuffer();​
 +result.append("<​costcenter>​\n"​);​
 +result.append("<​id>"​).append(id).append("</​id>​\n"​);​
 +result.append("<​name>"​).append(costCenterName).append("</​name>​\n"​);​
 +result.append("<​costId>"​).append(costCenter).append("</​costId>​\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);​
 +
 +</​code>​
 +
 +----
 +
 +Go to: **[[:​api_documentation|REST API Overview]] > [[:​manage_cost_center|Manage Cost Center]]**
 

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