Typically Request translator is used to provide custom preferences rather than relying on default GeoTAX API's preferences.
create or replace function geotax_preference_request_translator(event object)
returns object
language javascript as
'
var preferences={
"output": {
"taxDistrict": "SPD",
"salesTaxRateType": "GENERAL",
"outputCasing": "MIXED"
},
"geocoding": {
"defaultBufferWidth": "0",
"latLongOffset": "NONE",
"squeeze": "NO",
"latLongAltFormat": "DecimalSign"
},
"matching": {
"matchMode": "CLOSE"
}
};
return {"body": {"preferences":preferences, "data":EVENT.body.data}};
';
To use the Request Translator user needs to pass it to the external user defined function as
highlighted
below:
create or replace external function geotax_address(address object)
returns variant
IMMUTABLE
api_integration = API_INTEGRATION
REQUEST_TRANSLATOR = geotax_preference_request_translator
HEADERS = ('headers-api-key'= '<<API KEY>>', 'headers-api-secret'='<<API SECRET>>')
MAX_BATCH_ROWS = 10
as 'https://9a3cydoxrc.execute-api.us-east-1.amazonaws.com/v1/geo-tax-address';