Example 1: Send a SMS message on the Twilio platform
CallRestAPI(
SetRequestBaseURL('https://api.twilio.com/2010-04-01'),
SetRequestResource('/Accounts/{0}/Messages.json', 'Twilio_AccountSID'),
SetRequestDetails('Post'),
SetRequestHeaders(),
SetRequestParams('From', '+441403540192', 'To', '07748344932', 'Body', 'North52 Rocks!!'),
SetRequestAuthenticationBasic('Twilio_AccountSID', 'Twilio_AuthToken'),
SetRequestFiles(),
SetRequestExpected('Created'),
SetRequestActionPass(),
SetRequestActionFail()
)
Example 2: Send a SMS message on the Twilio platform, with an Action
CallRestAPI(
SetRequestBaseURL('https://api.twilio.com/2010-04-01'),
SetRequestResource('/Accounts/{0}/Messages.json', 'Twilio_AccountSID'),
SetRequestDetails('Post'),
SetRequestHeaders(),
SetRequestParams('From', '+441403540192', 'To', '07748344932', 'Body', 'North52 Rocks!!'),
SetRequestAuthenticationBasic('Twilio_AccountSID', 'Twilio_AuthToken'),
SetRequestFiles(),
SetRequestExpected('Created'),
SetRequestActionPass(CreateRecord('task',
1,
SetAttribute('subject', 'SMS ID:' + GetVarJsonValue('sid') + ' DateCreated:' +
GetVarJsonValue('date_created')
)
)
),
SetRequestActionFail()
)
Example 3: Retrieve all SMS messages on the Twilio platform, with an Action
CallRestAPI(
SetRequestBaseURL('https://api.twilio.com/2010-04-01'),
SetRequestResource('/Accounts/{0}/Messages.json', 'Twilio_AccountSID'),
SetRequestDetails('Get'),
SetRequestHeaders(),
SetRequestParams(),
SetRequestAuthenticationBasic('Twilio_AccountSID', 'Twilio_AuthToken'),
SetRequestFiles(),
SetRequestExpected('OK' ),
SetRequestActionPass(
ForEachRecord(GetVarJsonEC('messages'),
CreateRecord('task',
1,
SetAttribute('subject', 'SMS ID:' + CurrentRecord('sid') )
)
)
),
SetRequestActionFail()
)
Example 4: Make an IDOL request to get content
CallRestAPI(
SetRequestBaseURL('https://api.idolondemand.com/'),
SetRequestResource('1/api/sync/getcontent/v1),
SetRequestDetails('Get'),
SetRequestHeaders(),
SetRequestParams('index_reference', 'http://en.wikipedia.org/wiki/Alan Turing', 'highlight_expression',
'Alan Turing', 'apikey', 'enter_apikey'),
SetRequestAuthenticationNone(),
SetRequestFiles(),
SetRequestExpected('OK' ),
SetRequestActionPass(
UpdateRecord('account',
[account.accountid] ,
SetAttribute('description', GetVarJsonValue('documents{0}.wikipedia_category{16}'))
)
),
SetRequestActionFail()
)
Example 5: Convert some HTML to a PDF document and store as an attachment
CallRestAPI(
SetRequestBaseURL('https://htmlpdfapi.com/api/v1'),
SetRequestResource('/pdf'),
SetRequestDetails('Post'),
SetRequestHeaders('Authentication', 'Token'),
SetRequestParams('html', 'enter html here'),
SetRequestAuthenticationNone(),
SetRequestFiles(),
SetRequestExpected('OK' ),
SetRequestActionPass(
CreateNote('title', 'account', [account.accountid] , 'note',
'result.pdf', 'application/pdf', GetVar('file'))
),
SetRequestActionFail()
)
Example 6: Convert HTML in an attachment to a PDF and store result as a attachment
CallRestAPI(
SetRequestBaseURL('https://htmlpdfapi.com/api/v1'),
SetRequestResource('/pdf'),
SetRequestDetails('Post'),
SetRequestHeaders('Authentication', 'Token XXXXXXXXXXXXXXXXX'),
SetRequestParams(),
SetRequestAuthenticationNone(),
SetRequestFiles(
SetRequestFile('file',
Base64Decode(FindValue('annotation', 'objectid',
[account.accountid],'documentbody')),
'file.html',
'plain/text')
),
SetRequestExpected('OK' ),
SetRequestActionPass(
CreateNote('title', 'account', [account.accountid] , 'note',
'result.pdf', 'application/pdf', GetVar('file'))
),
SetRequestActionFail()
)