Webservice Functions
WebserviceGetBinary Function
Description
Performs a GET request against any URL to return a binary value.
This function should be used to obtain binary resources such as images, pdfs and other non-textual resources on a website or webservice.
This function should often be used in conjunction Base64EncodeBinary function to translate the returned value to a textual representation.
Syntax
- WebserviceGetBinary ( url [, webservicebehaviourid])
Arguments
- url
- This is the Url of the resource.
- If a webservice behaviour is specified the Query Url will be combined with the Base Url of the Webservice Beahviour to make the full Url. If no Webservice Behaviour is defined this must be the full Url.
- Optional. webservicebehaviourid
- The webservice behaviour used for authentication, base url, paging & throttling.
Example
To obtain the png image from the Realisable website.
WebserviceGetBinary("https://www.realisable.co.uk.co.uk/logo/realisable.png")
Obtain the resource being pointed to by the 'Url' field.
WebserviceGetBinary(%Url)
Obtain the resource by querying the labels endpoint of the 'PARCELFORCE' webservice.
WebserviceGetBinary("/labels?id=" & %Id, "PARCELFORCE")
Extending the above function by translating the returned binary function to a Base64 encoded string.
Base64EncodeBinary(WebserviceGetBinary("/labels?id=" & %Id, "PARCELFORCE"))
WebserviceGetText Function
Description
Performs a GET request against any URL to return a textual value such as a CSV, JSON, or other textual resource.
Syntax
- WebserviceGetText ( url [, webservicebehaviourid])
Arguments
- url
- This is the Url of the resource.
- If a webservice behaviour is specified the Query Url will be combined with the Base Url of the Webservice Beahviour to make the full Url. If no Webservice Behaviour is defined this must be the full Url.
- Optional. webservicebehaviourid
- The webservice behaviour used for authentication, base url, paging & throttling.
Example
To obtain the png image from the Realisable website.
WebserviceGetText("https://www.realisable.co.uk.co.uk/files/orders.csv")
Obtain the resource being pointed to by the 'Url' field.
WebserviceGetText(%Url)
Obtain the document in Salesforce by querying the ContentVersion endpoint of the 'SALESFORCE' webservice by pointed to by the Id field.
WebserviceGetText("/services/data/v46.0/sobjects/ContentVersion/" & %Id & "/VersionData", "SALESFORCE")
WebserviceLookup
Description
Performs a lookup against a REST based webservice, where the webservice being queried is defined in Setup, Webservices, Webservice Lookup. (See Webservice Lookups)
Syntax
- WebserviceLookup( lookupid, wherevalues, mustreturnvalue, returnpath )
Arguments
- lookupid
- The id of the webservice lookup.
- wherevalues
- The value or values used to parameterise the query. Multiple parameters should be enclosed in the Array function.
- mustreturnvalues
- When specified as true, the lookup will raise an error if the lookup fails to return a record.
- When false if no record is returned, the return value is an empty string.
- returnpath
- Is optional.
- When specified overrides the Return Path property defined on the Webservice Lookup. The return path should be in the either syntax of XPath or JPath dependent content type of the lookup.
Examples
To perform a lookup against the lookup with id “SHOPIFYCUST” where the Email field is parameter to the GET request.
WebserviceLookup(“SHOPIFYCUST”, %Email, true)
To perform a lookup against the lookup with id “SHOPIFYCUST” where the Email field is a parameter to the GET request and the Return Path is specified in JPath format.
WebserviceLookup(“SHOPIFYCUST”, %Email, true, “/customers[]/email”)
To perform a lookup where multiple parameters (Name & Postcode) are required.
WebserviceLookup(“TAXCODE”, Array(%Name, %Postcode), true, “/result/taxcode”)