diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf75e4..29b7560 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [Version 1.4.3](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.4.3) - Bugfix - 2026-07-27 + +- Fix templating for multiform body + ## [Version 1.4.2](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.4.2) - Bugfix - 2026-07-22 - Remove user's 'Other credentials' from recipe's logs diff --git a/custom-recipes/api-connect/recipe.json b/custom-recipes/api-connect/recipe.json index f836ed9..2a1a757 100644 --- a/custom-recipes/api-connect/recipe.json +++ b/custom-recipes/api-connect/recipe.json @@ -165,7 +165,7 @@ { "type": "SEPARATOR", "label": "Template variables", - "description": "URL, headers and parameters can be templated using {{variables}}" + "description": "URL, headers, parameters and body can be templated using {{variables}}" }, { "name": "parameter_columns", diff --git a/plugin.json b/plugin.json index 43a5253..bcb14b8 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "id": "api-connect", - "version": "1.4.2", + "version": "1.4.3", "meta": { "label": "API Connect", "description": "Retrieve data from any REST API", diff --git a/python-lib/dku_constants.py b/python-lib/dku_constants.py index 2ef6695..ae28a23 100644 --- a/python-lib/dku_constants.py +++ b/python-lib/dku_constants.py @@ -2,7 +2,7 @@ class DKUConstants(object): API_RESPONSE_KEY = "api_response" FORBIDDEN_KEYS = ["token", "password", "api_key_value", "secure_token", "mtls_key_path", "mtls_certificate_path"] FORM_DATA_BODY_FORMAT = "FORM_DATA" - PLUGIN_VERSION = "1.4.2" + PLUGIN_VERSION = "1.4.3" RAW_BODY_FORMAT = "RAW" MULTIPART_FORM_DATA_BODY_FORMAT = "MULTIPART_FORM_DATA" REPONSE_ERROR_KEY = "dku_error" diff --git a/python-lib/rest_api_client.py b/python-lib/rest_api_client.py index 1383be7..d57e5d4 100644 --- a/python-lib/rest_api_client.py +++ b/python-lib/rest_api_client.py @@ -115,7 +115,10 @@ def __init__(self, credential, secure_credentials, endpoint, custom_key_values={ self.requests_kwargs.update({"json": get_dku_key_values(key_value_body)}) elif body_format in [DKUConstants.MULTIPART_FORM_DATA_BODY_FORMAT]: key_value_body = endpoint.get("key_value_body", {}) - self.requests_kwargs.update({"files": {k: (None, v) for k, v in get_dku_key_values(key_value_body).items()}}) + files = {} + for key, value in get_dku_key_values(key_value_body).items(): + files[key] = (None, format_template(value, **self.presets_variables)) + self.requests_kwargs.update({"files": files}) self.metadata = {} if self.behaviour_when_error == "keep-error-column": self.metadata = {DKUConstants.REPONSE_ERROR_KEY: None}