Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion custom-recipes/api-connect/recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion python-lib/dku_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
5 changes: 4 additions & 1 deletion python-lib/rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code technically works but it the keyword replacement logic should be put downstream where it is for all the other formats IMO
(ie line 155). The issue is that format_template currently doesn't handle tuples. I think it would be cleaner to just modify it to handle them.

self.requests_kwargs.update({"files": files})
self.metadata = {}
if self.behaviour_when_error == "keep-error-column":
self.metadata = {DKUConstants.REPONSE_ERROR_KEY: None}
Expand Down