6.1.3 Making Synchronous Request

This method is used to request a specific synchronous service or operation from a service provider, using call() API.

Syntax

result = service_instance_object.call(operation, parameters)

Arguments

The operation argument describes the service requested from the service provider.

The parameters argument is a dictionary, which specifies input parameters to the specified request.

Return Value

The Return value contains the service output, and its data type depends on the service requested.

Example

The following sample code illustrates how to retrieve all the Sender IDs from Inbox using GetList:

import scriptext

messaging_handle = scriptext.load('Service.Messaging', 'IMessaging')

# This 'GetList' request returns all the SMS in the inbox as an iterable map

sms_iter = messaging_handle.call('GetList', {'Type': u'Inbox'})

sender_list = [] 

for sms_dict in sms_iter: 
 if sms_dict['MessageType'] == 'SMS': 
  sender_list.append(sms_dict['Sender'])

print "ID list :", sender_list

See About this document... for information on suggesting changes.