Adding pdf file to exsting columns in form through api

it will show file not found and no url in data when i download excel .
please correct below code

URL = f’https://kf.kobotoolbox.org/api/v2/assets/{project_id}/data/bulk/

PARAMS = {
‘format’: ‘json’
}

HEADERS = {
‘Authorization’: f’Token {TOKEN}’
}

file_path = ‘signed_user_agreement.pdf’ # or path to the image file
with open(file_path, ‘rb’) as file:

# Create the payload without the file name
payload = {
    'submission_ids': ['395241386'],
     'data': {

‘End_user_agreement_file’: ‘signed_user_agreement.pdf’
},
‘data_type’: ‘media’,
‘confirm’: ‘true’
}

# Create the files dictionary for the file upload
files = {
    'signed_user_agreement.pdf': file }

# Send the request
res = requests.patch(
    url=URL,
    data={'payload': json.dumps(payload)},  # Send other form data directly
    files=files,  # Include the file in the request
    params=PARAMS,
    headers=HEADERS
)

# Print response status code and text
print(res.status_code)
print(res.text)

correct the above code to upload the file properly

Welcome to the community, @shivaraj! This post discussed previously should help you solve your issue:

just assume i have column named agreement for that i will upload pdf file for particular individual submission. But due to some problem i want to change that uploaded file for more than 5oo entries. so i want upload pdf file based on submission_ids.

The above given solution is for uploading media files, i want to upload a file for individual submission

,
,