Cisco Cisco Prime Home 3.0 Developer's Guide

Page of 78
Cisco Prime Home – Integration Guide
 
 
OL-28557-01   v5.0.1
 
62 
HTTP Interaction (Browser) 
1.
  GET /acs-portal/control-panel/login?cpSessionId=527BBB943DAAE5838 
D11298EAC8442DABD3BC2A0&device=001A2B:001A2B999999
, confirms the session 
and configures the browser's cookies, forwarding them to the control panel UI, if all is good. 
2.
  GET /acs-portal/controlpanel? 
cpSessionId=527BBB943DAAE5838D11298EAC8442DABD3BC2A0&device=001A2B
:001A2B999999, 
the actual control panel UI.
 
 
Sample Code 
ControlPanelSessionService.scala 
 
package com.clearaccess.example.api 
 
import org.springframework.beans.factory.annotation.Autowired 
import com.clearaccess.spring.rest.RestTemplate 
import com.clearaccess.example.HttpConfiguration 
import org.json.JSONObject 
import org.springframework.stereotype.Component 
 
@Component 
class ControlPanelSessionService @Autowired()( 
val restTemplate: RestTemplate, 
val httpConfiguration: HttpConfiguration 
)   { 
private lazy val sessionsControlPanelURL = 
"http://%s/prime-home/api/v1/sessions/controlPanel".format(httpCon 
figuration.host) 
/** 
* makes an authenticated call to create a control panel session 
for the subscriber 

* @param subscriberCode the unique code of the subscriber 
* @return a control panel session with a cpSessionId 
*/ 
def createProxySession(subscriberCode: String): 
ControlPanelSession = { 
val cpSession = new ControlPanelSession(new JSONObject) 
cpSession.setSubscriberCode(subscriberCode) 
new 
ControlPanelSession(restTemplate.postForObject(sessionsControlPanel 
URL, cpSession.json, classOf[JSONObject])) 

 
/** 
* makes an authenticated call to create a control panel session 
for the subscriber 
* who owns the device indicated by the provided oui / serial 
number 

* @param oui the subscriber's device's oui 
* @param sn the subscriber's device's serial number 
* @return a control panel session with a cpSessionId 
*/ 
def createProxySession(oui: String, sn: 
String):ControlPanelSession = { 
val cpSession = new ControlPanelSession(new JSONObject) 
cpSession.setOuiSn(oui, sn) 
new