API Docs
After the application has retrieved a session token using the SignOnWithToken/SignOn operation and all necessary application configuration data has been saved, the application must retrieve Service Information to determine what services have been authorized for a specific Service Key.
Service Information includes:
Refer to Understanding Service Information for more information.
The following operations are used to facilitate the retrieval of Service Information for both SOAP and REST implementations:
Service Information Operations |
GetServiceInformation |
Important! All parameters in each operation are considered “required” unless otherwise noted.
The GetServiceInformation operation provides information about the services that are available to a specific Service Key. This operation should be automatically invoked during initial application configuration, and manually by an application administrator if/when available services are updated.
Refer to Understanding Service Information for more information.
ServiceInformation GetServiceInformation(string sessionToken);
Parameter | Data Type | Description |
sessionToken | String | The short-lived token used to authenticate to CWS. |
Data Type | Description |
ServiceInformation | Contains information about the features, workflows, and operations associated with all available services for a specific Service Key. |
CWSFault | AuthenticationFault |
ExpiredTokenFault | CWSServiceInformationUnavailableFault |
InvalidTokenFault |
For additional details about each fault, refer to Service Information Faults in the CWS Developer API Reference.
Note: The HTTP Authorization Header must contain the required sessionToken value.
URL | https://api.nabcommerce.com/REST/2.0.18/SvcInfo/serviceInformation |
Action | GET |
None.
None.
Data Type | Description |
ServiceInformation | Contains information about the features, workflows, and operations associated with all available services for a specific Service Key. |
CWSFault | AuthenticationFault |
ExpiredTokenFault | CWSServiceInformationUnavailableFault |
InvalidTokenFault |
For additional details about each fault, refer to Service Information Faults in the CWS Developer API Reference.
public function getServiceInformation()
{
if (! $this->signOn ())
return false;
try
{
$si = new GetServiceInformation ();
$si->sessionToken = $this->session_token;
$response = $this->serviceInfo->GetServiceInformation ( $si );
if ($response)
//echo $this->serviceInfo->__getLastResponse();
//return $response->GetServiceInformationResult->BankcardServices->BankcardService;
return $response->GetServiceInformationResult;
}
catch ( SoapFault $e )
{
echo 'SERVER ERROR: Error Retrieving Service Information.
';
$xmlFault = $this->serviceInfo->__getLastResponse ();
$errors = handleSvcInfoFault ( $e, $xmlFault );
echo $errors;
exit ();
}
}
// Return only the ServiceId
public function getServiceID()
{
$response = $this->getServiceInformation ();
if ($response)
//return $response->GetServiceInformationResult->BankcardServices->BankcardService->ServiceId;
return $response->GetServiceInformationResponse;
return false;
}
public ServiceInformation GetServiceInformation(string sessionToken)
{
using (var client = new CWSServiceInformationClient(ConfigurationManager.AppSettings["Bindings.StsSoap"]))
{
try
{
return client.GetServiceInformation(sessionToken);
}
catch (FaultException ex)
{
SoapFaultHandler.HandleFaultException(ex);
}
}
}
Note: The HTTP Authorization Header must contain the required sessionToken value.
URL | https://api.nabcommerce.com/REST/2.0.18/SvcInfo/serviceInformation |
Action | GET |
None.
None.
Data Type | Description |
ServiceInformation | Contains information about the features, workflows, and operations associated with all available services for a specific Service Key. |
CWSFault | AuthenticationFault |
ExpiredTokenFault | CWSServiceInformationUnavailableFault |
InvalidTokenFault |
For additional details about each fault, refer to Service Information Faults in the CWS Developer API Reference.
public function getServiceInformation()
{
if (! $this->signOn ())
return false;
$msgBody = '';
$url = $this->svcInfo.'/serviceInformation';
$action = 'GET';
$siResponse = curl_json($msgBody, $url, $action, $this->session_token);
if(isset($response->body->ErrorId))
{
handleRestFault($response);
return false;
}
if(isset($siResponse[2]))
{
//This section will parse the response and create the required object for each service. It will only grab the first of each, a foreach would be needed to grab all.
$si = new stdClass();
if(count($siResponse[2]->BankcardServices))
$si->BankcardServices->BankcardService = $siResponse[2]->BankcardServices[0];
if(count($siResponse[2]->ElectronicCheckingServices))
$si->ElectronicCheckingServices->ElectronicCheckingService = $siResponse[2]->ElectronicCheckingServices[0];
if(count($siResponse[2]->StoredValueServices))
$si->StoredValueServices->StoredValueService = $siResponse[2]->StoredValueServices[0];
if(count($siResponse[2]->Workflows))
$si->Workflows->Workflow = $siResponse[2]->Workflows[0];
return $si;
}
return false;
}
// Return only the ServiceId
public function getServiceID()
{
$si = getServiceInformation();
return $si->BankcardServices->BankcardService->ServiceId;
}
public ServiceInformation GetServiceInformation(string sessionToken)
{
var isJson = string.Equals(_msgFormat, MessageFormat.JSON.ToString());
// No body is required for GetServiceInformation in the HttpWebRequest.
var requestString = RestBaseUri + "/serviceInformation";
HttpWebRequest request = WebRequest.Create(requestString) as HttpWebRequest;
request.Method = HttpMethod.GET.ToString();
request.Credentials = new NetworkCredential(sessionToken, "");
request.ContentType = isJson ? "application/json" : "application/xml";
try
{
return RestHelper.GetResponse(request, isJson);
}
catch (Exception ex)
{
RestFaultHandler.HandleFaultException(ex, isJson);
}
}
Updated: June 2, 2017
SUBMIT A DEVELOPER SUPPORT REQUEST
Agent or a merchant? Contact NAB support at 866.485.8999 EXT 2341