Hi @efcorpa
FYI: Zapier does not share ETA for issues or feature requests.
Ok, since there’s no alternative, I finally went for the workaround which I must say, it’s been harder than expected.
This comment pretends to save time to people having this issue and trying to implement a Code By Zapier multipart/form-data API call:
First of all, if you use javascript with the provided nodejs environment, you’ll face your request parameters won’t be correctly handled and wont’ be considered by server. After several hours doing some googling and chatgpt, it seems the method getHeaders() of the “form-data” library of the nodejs environment is not providing the correct Conten-Type with boundary information. This might be caused by an old or buggy version.
So I went for the Python option (last alternative) and it worked like a charm, except for some trouble when hydrating the file I wanted to send from a prevoius step. This is my working code:
import requests
import urllib.request
endpoint_url = "YOUR ENDPOINT URL HERE"
oauth_token = input_data.get('oauth_token')
expedient_number = input_data.get('expedient_number')
file_source = input_data.get('file_source')
file_name = input_data.get('file_name')
form_data = {
"DocumentTypeId": 144,
"Expedients 0]": expedient_number
}
headers = {
"Authorization": f"Bearer {oauth_token}"
}
file_content = urllib.request.urlopen(file_source).read()
print(f"File size: {len(file_content)} bytes")
files = {
"fileContent": (file_name, file_content)
}
try:
response = requests.post(endpoint_url, data=form_data, files=files, headers=headers)
print("Status Code:", response.status_code)
print("Response Text:", response.text)
except requests.exceptions.RequestException as e:
print("Something went wrong:", e)
Hope it helps somebody