7 Adding RESTful Application Subscription Management Support

This chapter describes the operations in the Application Subscription Management interface of the RESTful facade provided in Oracle Communications Services Gatekeeper.

About Application Subscription Management

The Services Gatekeeper Application Subscription Management supports Open Mobile Alliance (OMA) General Service Subscription Management (GSSM) functionality including subscription management, subscription profile access, and subscription validation.

For information on the OMA GSSM specification see:

http://technical.openmobilealliance.org/Technical/release_program/gssm_v1_0.aspx

Application Subscription Management includes both a communication service and RESTful interfaces for managing and querying service subscription status. Applications use the RESTful interfaces to manage subscriptions and query subscription status. Application Subscription Management grants or restricts application access to a subscriber's communication services based on the subscription status. Application Subscription Management also supports OAuth authentication when required.

For information on using the Application Subscription Management communication service, including deploying, configuring and monitoring, see Services Gatekeeper Communication Service Reference Guide.

REST Service Descriptions Available at Run-time

When the Administration Server for your Services Gatekeeper domain is in the running state, the REST service descriptions of Service Subscription Management interface operations can be found at

http://host:port/subscription/application.wadl

where host and port are the host name and port of the system on which Services Gatekeeper is installed.

Subscribe

The Subscribe operation creates a new application service subscription request for a subscriber based on the MSISDN.

Authorization

Basic or OAuth

HTTP Method

POST

URI

http://host:port/subscription

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for Subscribe accepts the following parameters:

  • applicationName: String. The name of the application subscribed to.

  • subscriberAddress: String. The MSISDN of the subscriber making the request.

Response Header

The response header indicates whether the subscription request was successfully created. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Response Body

The response body contains the following parameters:

  • subscriptionResponse: String. The Services Gatekeeper generated response containing the subscription ID.

    • subscriptionID: String. The ID of the new subscription.

Examples

Example 7-1 shows a sample Subscribe request.

Example 7-1 Subscribe Request Example

POST /subscription HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: Basic YXBwX3VzZXI6YXBwX3VzZXI=
Accept: application/json
Content-Length: 60
Host: vm-at1:8001
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
.
applicationName=Mickey News&subscriberAddress=tel:0703322124
.

Example 7-2 shows a sample Subscribe response.

Example 7-2 Subscribe Response Example

HTTP/1.1 201 Created
Date: Wed, 01 Jul 2015 07:13:07 GMT
Content-Length: 78
Content-Type: application/json
.
{"subscriptionResp":{"subscriptionId":"1a7afc44-9e68-4dc6-aaf4-07610a9fdef0"}}

Unsubscribe

The Unsubscribe operation is used to request a subscription deletion.

Authorization

Basic or OAuth

HTTP Method

DELETE

URI

http://host:port/subscription

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The Unsubscribe request header contains the subscription ID to be deleted. The MIME-type for the Content-Type header field is application/json.

Request Body

There is no response body.

Response Header

The response header indicates whether the ACR status was successfully changed. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The response body contains no content.

Examples

Example 7-3 shows a sample Unsubscribe request.

Example 7-3 Unsubscribe Request Example

DELETE /subscription/e4e3cb51-994b-46e1-b0d1-0757a8bca25f HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-4 shows a sample Unsubscribe response.

Example 7-4 Unsubscribe Response Example

HTTP/1.1 204 No Content

Suspend

The Suspend operation suspends an existing service subscription for a subscriber based on the subscription ID.

Authorization

Basic

HTTP Method

PUT

URI

http://host:port/subscription/suspend/subscriptionID

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

  • subscriptionID is the ID of the subscription to be suspended.

Request Header

The Suspend request header contains the ID of the subscription to be suspended. The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for Suspend is empty.

Response Header

The response header indicates whether the subscription was successfully suspended. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The response body contains no content.

Examples

Example 7-5 shows a sample Suspend request.

Example 7-5 Suspend Request Example

PUT /subscription/suspend/e4e3cb51-994b-46e1-b0d1-0757a8bca25f HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-6 shows a sample Suspend response.

Example 7-6 Suspend Response Example

HTTP/1.1 204 No Content

Unsuspend

The Unsuspend operation unsuspends an existing service subscription for a subscriber based on subscription ID.

Authorization

Basic

HTTP Method

PUT

URI

http://host:port/subscription/unsuspend/subscriptionID

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

  • subscriptionID is the ID of the subscription to be suspended.

Request Header

The Unsuspend request header contains the subscription ID to be unsuspended. The MIME-type for the Content-Type header field is application/json

Request Body

The request body for unsuspend is empty.

Response Header

The response header indicates whether the subscription was successfully removed from being suspended. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The response body contains no content.

Examples

Example 7-7 shows a sample Unsuspend request.

Example 7-7 Unsuspend Request Example

PUT /subscription/unsuspend/e4e3cb51-994b-46e1-b0d1-0757a8bca25f HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-8 shows a sample Unuspend response.

Example 7-8 Unsuspend Response Example

HTTP/1.1 204 No Content

Notify

The Notify operation notifies a registered application of a subscription management request.

Authorization

Basic or OAuth

HTTP Method

POST

URI

http://host:port/notify

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for Notify accepts the following parameters:

  • subscriptionNotification. The Services Gatekeeper generated notification containing the following parameters:

    • subscriptionID: String. The ID of the subscription request.

    • applicationName: String. The name of the application receiving the request.

    • subscriberAddress: String. The MSISDN of the requesting subscriber.

    • operation: String. The subscription request type. For example, Subscribe or Unsubscribe.

Response Header

Standard header fields. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The response body contains no content.

Examples

Example 7-9 shows a sample Notify request.

Example 7-9 Notify Request Example

POST /notifysubscription HTTP/1.1Host: example.com:80
Accept: application/json
Content-Type: application/json
Content-Length: 173
{"subscriptionNotification":{"subscriptionId":
"e4e3cb51-994b-46e1-b0d1-0757a8bca25f","applicationName":"Oracle
News","subscriberAddress":"tel:1111","operation":"Subscribe"}}

Example 7-10 shows a sample Notify response.

Example 7-10 Notify Response Example

HTTP/1.1 204 No Content

Confirm

The Confirm operation is used by applications to confirm subscription requests.

Authorization

Basic or OAuth

HTTP Method

PUT

URI

http://host:port/subscription/confirm

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for Confirm accepts the following parameters:

  • operation: String. The subscription request operation being confirmed. For example, Subscribe or Unsubscribe.

  • confirmResult: String. The subscription request status. For example, approved.

Response Header

Standard header fields. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The response body contains the following parameter:

  • oauthAccessToken: String. If OAuth is required, Services Gatekeeper returns an OAuth accessToken in the response.

Examples

Example 7-11 shows a sample Confirm request.

Example 7-11 Confirm Request Example

PUT /subscription/confirm/e4e3cb51-994b-46e1-b0d1-0757a8bca25f HTTP/1.1
Host: example.com:80
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Content-Length: 42operation=Subscribe&confirmResult=Approved

Example 7-12 shows a sample Confirm response with an OAuth accessToken.

Example 7-12 Confirm Response Example

HTTP/1.1 200 OK
Content-Type: application/json
Date:  Wed, 07 Nov 2012 06:39:50 GMT
{"oauthAccessToken":{"oauthAccessToken":"e4e3cb51-994b-46e1-b0d1-0757a8bca25f"}}

queryBySubscriberAddress

The queryBySubscriberAddress operation retrieves a user's subscription information based on the subscriber address.

Authorization

Basic

HTTP Method

GET

URI

http://host:port/subscription/query/queryBySubscriberAddress

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The queryBySubscriberAddress request header contains the subscriber address (MSISDN) to be queried. The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for queryBySubscriberAddress is empty.

Response Header

The response header includes the request status. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The request body for queryBySubscriberAddress contains the following parameters:

  • subscriptionList. The Services Gatekeeper generated list containing the following parameters:

    • subscriptionInfo. Array. Contains the following parameters for each subscription.

      • applicationName: String. The name of the subscribed application.

      • subscriberAddress: String. The MSISDN of the subscriber.

      • status: String. The subscription status. For example, Pending.

Examples

Example 7-13 shows a sample queryBySubscriberAddress request.

Example 7-13 queryBySubscriberAddress Request Example

GET /subscription/query/queryBySubscriberAddress/tel:1111?offSet=0&batchSize=2
 HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-14 shows a sample queryBySubscriberAddress response.

Example 7-14 queryBySubscriberAddress Response Example

HTTP/1.1 200 OK
Content-Type: application/json
Date:  Wed, 07 Nov 2012 06:56:05 GMT
 
{"subscriptionList":{"subscriptionInfo":[{"applicationName":"coderslist",
"subscriberAddress":"tel:1111","status":"SubscribePending"},{"applicationName":
"Oracle News","subscriberAddress":"tel:1111",
"status":"UnSubscribePending"}]}}

queryByApplicationName

The queryByApplicationName operation retrieves a list of subscribers to an application based on the application ID.

Authorization

Basic

HTTP Method

GET

URI

http://host:port/subscription/query/queryByApplicationName

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The queryByApplicationName request header contains the application name to be queried. The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for queryBySubscriberAddress is empty.

Response Header

The response header includes the request status. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The request body for queryByApplicationName contains the following parameters:

  • subscriptionList. The Services Gatekeeper generated list containing the following parameters:

    • subscriptionInfo. Array. Contains the following parameters for each subscribed user.

      • applicationName: String. The name of the subscribed application.

      • subscriberAddress: String. The MSISDN of the subscriber.

      • status: String. The subscription status. For example, Pending.

Examples

Example 7-15 shows a sample queryByApplicationName request.

Example 7-15 queryByApplicationName Request Example

GET /subscription/query/queryByApplicationName/Oracle%20News?offSet=0&
batchSize=2 HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-16 shows a sample queryByApplicationName response.

Example 7-16 queryByApplicationName Response Example

HTTP/1.1 200 OK
Content-Type: application/json
Date:  Wed, 07 Nov 2012 06:56:05 GMT
 
{"subscriptionList":{"subscriptionInfo":[{"applicationName":"Oracle
News","subscriberAddress":"tel:1111","status":"UnSubscribePending"},
{"applicationName":"Oracle
 News","subscriberAddress":"tel:1112","status":"Active"}]}}

queryBySubscriptionID

The queryBySubscriptionID operation retrieves application subscription information for a subscriber based on the subscription ID.

Authorization

Basic

HTTP Method

GET

URI

http://host:port/subscription/query/queryBySubscriptionID

where:

  • host and port are the host name and port of the system on which Services Gatekeeper is installed.

Request Header

The queryBySubscriptionID request header contains the subscription ID to be queried. The MIME-type for the Content-Type header field is application/json.

Request Body

The request body for queryBySubscriptionID is empty.

Response Header

The response header includes the request status. If the request fails, the Status-Line header field will contain the status code and the reason for the failure. See Services Gatekeeper Communication Service Reference Guide, for more information on error messages.

Response Body

The request body for queryBySubscriptionID contains the following:

  • subscriptionInfo. The Services Gatekeeper generated list with the following parameters:

    • applicationName: String. The name of the subscribed application.

    • subscriberAddress: String. The MSISDN of the subscriber.

    • status: String. The subscription status. For example, Pending.

Examples

Example 7-17 shows a sample queryBySubscriptionID request.

Example 7-17 queryBySubscriptionID Request Example

GET /subscription/query/queryBySubscriptionId/e4e3cb51-994b-46e1-b0d1-0757
a8bca25f HTTP/1.1
Host: example.com:80
Accept: application/json

Example 7-18 shows a sample queryBySubscriptionID response.

Example 7-18 queryBySubscriptionID Response Example

HTTP/1.1 200 OKContent-Type: application/jsonDate:  Wed, 07 Nov 2012 06:56:05 GMT{"subscriptionInfo":{"applicationName":"Oracle
 News","subscriberAddress":"tel:1111","status":"UnSubscribePending"}}
HTTP/1.1 200 OK