The following methods are available via the servicesubscriptions web-service:
ChangePublicStatusOfService
The ChangePublicStatusOfService allows an external website to change the status
of a private service between public, i.e., all users can subscribe to the service,
and non-public, i.e., only the creator can subscribe.
public bool ChangePublicStatusOfService(
int editorId,
bool newPublicStatus,
int serviceId,
string signature,
string timestamp)
The method takes a serviceId, and a the new status of the service, i.e., true or
false. The method returns a boolean value indicating whether or not the update succeeded.
CreateApprovedMultiSubscription
The CreateApprovedMultiSubscription method allows trusted service providers to create
approved subscriptions for a list of users. This means that the users will begin
receiving content from the service provider instantly, without manually having to
approve the subscription. If you feel that you should be a trusted service provider,
please contact us at rw [@] cs.aau.dk or khp1412 [@] cs.aau.dk.
public void CreateApprovedMultiSubscription(
int serviceProviderId,
string serviceProviderPassword,
int[] subscribedUserIds,
int[] serviceIds)
The method parameters are the service provider id and password, along with an integer
array of userids, and an integer array of serviceids.
Each userid must have a matching serviceid, i.e., the length of the arrays must
be similar. The matching arrays of service and userids, allows for individualized
service subscriptions. If the same service id is to be used for all subscriptions,
then this id must be present for each user id.
CreateApprovedSubscription
The CreateApprovedSubscription method creates an approved subscription for a single
user, i.e., the user will begin recieving service content immediatly without having
to manually approve the subscription.
public void CreateApprovedSubscription(
int serviceProviderId,
string serviceProviderPassword,
int subscribedUserId,
int serviceId,
bool isPublic)
The method takes a service provider id and password. The id of the user begin subscribed,
along with a serviceid to which to subscribe.
The isPublic parameter indicates whether the service is private or public.
The CreateMultiSubscription method creates a subscription for a list of users in
the same way as the CreateApprovedMultiSubscription method.
Only diffence being that each user has to manually approve the subscription before
receiving content. The CreateMultiSubscription method is available to everyone,
unlike the CreateApprovedMultiSubscription method that are only available to trusted
service providers.
public void CreateMultiSubscription(
int serviceProviderId,
string serviceProviderPassword,
int[] subscribedUserIds,
int[] serviceIds)
Creates a private service.
The service groups and ids can be seen in the Service Group item below.
public int CreatePrivateService(
bool allowMultiSubscription,
string description,
int groupid,
bool isPublic,
string name,
bool requiresSetup,
string signature,
string startServiceUrl,
string subscriptionPassword,
string timestamp,
string url,
int userid
string[] tags
string serviceScriptUrl
string serviceScript
)
The tags should not be used in the signature.
Deletes a service.
public int DeleteService(
int serviceId,
string signature,
string timestamp
)
Creates a non-approved subscription in the same way as the CreateApprovedSubscription
method.
public void CreateSubscription(
int serviceId,
int serviceProviderId,
string signature,
int subscribedUserId,
string timestamp)
The GetSId method creates a copy of the service to which a user is trying to subscribe.
i.e., if a user is trying to subscribe to a service which send user specific content,
then the user needs to subscribe to a unique serviceid.
One example of a subscription where the user needs to subscribe to a unique service
is the email service. If all users subscribed to the same service(id), then all
users would recieve everyones emails.
Therefore a new service (a copy) is created using the GetSId method, and the user
subscription is created using the id of the service copy.
If however the service broadcast info on your favorite football team, then everyone
would subscribe to the same service id. In this scenario no service copy would be
made, and the user would be subscribed without a call to the GetSId method.
public int GetSId(
string addToServiceTitle,
int editorUserId,
bool makePublic,
bool publicService,
int serviceId,
int serviceProviderId,
string signature,
string timestamp,
string url,
bool useParent)
How do I use the webservices to subscribe a
user to a private service?
The following is a piece of code which will create a subscription copy of an existing
private service.
The code uses a dll, which is freely available in the top of this page, to create
a timestamp, and to create a signature.
The signature is created using a secret key available from the MyAccount tab on
the streamspin webpage.
The text used in the signature is the various GetSId parameters in alphabetic order.
The GetSId method is then called to create a private service subscription copy.
This allows the service server to send messages to individual users.
The GetSId method returns a new service id or a web-service error code.
string timestamp = CryptoLib.Signatures.CreateTimeStamp(DateTime.Now);
string text =
txtSubscriptionName.Text + //addToServiceTitle
Session["sUserId"].ToString() + //subscribed user
id
"False" + //it is not a public service
"False" + //do we make the service public
Session["sOriginalServiceId"].ToString() + //original
service id
"8" + //service provider id
timestamp +
"http://www.streamspin.com/flickr.aspx" + //setup
url
"True"; //use parent
string signature = CryptoLib.Signatures.Sign(text, "[KEY]");
int newServiceId = subscriptionService.GetSId(
txtSubscriptionName.Text,
false,
Convert.ToInt32(Session["sUserId"]),
false,
Convert.ToInt32(Session["sOriginalServiceId"]),
8,
signature,
timestamp,
"http://www.streamspin.com/flickr.aspx",
true);