Studying Web service documentation
Before you start setting up integration with a REST web service, you need to have a complete understanding of how to call this web service and what kind of response it will return. This information is available in the web service documentation.
For example, to obtain currency exchange rates from http://fixer.io/, you can use one of the two GET method requests:
-
https://data.fixer.io/api/latest – to obtain latest exchange rates.
-
https://data.fixer.io/api/2000-01-03 – to obtain exchange rates for specific date (in this case, January 3, 2000).
The following parameters can be used in requests:
-
access_key – specifies your personal API access key for authentication on http://data.fixer.io/api/. You can obtain this code for free, by registering on http://fixer.io/. Required parameter.
-
base – specifies base currency, in relation to which the exchange rates will be obtained. For example, to get exchange rates in relation to US dollar, use the following request: https://data.fixer.io/latest?base=USD. If the “base” parameter is not passed, the rates will be returned in relation to Euro.
-
symbols – specifies the currencies, whose exchange rates must be returned. For example, to get exchange rates for US dollar and British pound only, use the following request: https://data.fixer.io/latest?symbols=USD,GBP. If the “symbols” parameter is not passed, the rates will be returned for all currencies that the web service supports.
Regardless of the request method and parameters, the web service returns responses of the same structure:
{"success":true,"timestamp":1521527348,"base":"EUR","date":"2018-02-22","rates":{"AUD":1.5699,"BGN":1.9558,...,"ZAR":14.384}}
Each response contains 3 parameters:
-
success – indicates whether exchange rate query was successful.
-
timestamp – object containing a standard UNIX time stamp indicating the time the given exchange rate data was collected.
-
base – specifies base currency, for the exchange rates. For example, "base":"EUR" indicates that the rates are returned in relation to Euro.
-
date – specifies the date of the exchange rates. For example, "date":"2018-02-22" indicates that the rates are returned for February 22, 2018.
-
rates – contains an array of nested parameters, each of which represents exchange rate between the base currency and one of the supported currencies. For example, "rates":{"GBP":0.88343,"USD":1.2276} means that the web service returned exchange rates for British Pound ("GBP":0.88343) and US dollar ("USD":1.2276).
Thus, to integrate with this web service, Creatio must be configured to execute the needed requests with the needed parameters and parse the response obtained from the web service.
See also