Server Error (500) on existing data update

Hello,
I am attempting to update a specific column variable within existing data using submission IDs. However, the updates are failing, and an error is being displayed: " Server Error (500)"
The code is in python:

import requests
import json

URL = 'https://kf.kobotoolbox.org/api/v2/assets/formID/data/bulk/'
TOKEN = 'secret'
PARAMS = {
    'format': 'json'
}
HEADERS = {
    'Authorization': f'Token {TOKEN}'
}

payload = {
    'submission_ids': ['259050319',
'259050324',
'259071342',
'259072431'
],
    'data': {'sectionC/commune': '555'}
}

res = requests.patch(
    url=URL,
    data={'payload': json.dumps(payload)},
    params=PARAMS,
    headers=HEADERS
)

print(res.status_code)
print(res.text)

Thanks

Welcome back to the community, @momou28! Maybe this post discussed previously should give you a clue on how to achieve it?

Thank you very much LAM. I followed the video that explains the solution using the Postman tool, and I applied the process, but I still get the same “500 Internal Server Error.” I think it’s a server-related error because the same script was working before. Could there be a blocking mechanism after several unsuccessful attempts? Ngnix or other bugs on your server! Thank you.

I have exactly the same problem. (use the same code)

What I have discovered is that it occurs only if the record was created via Kobocollect.
If its created via Enketo, the code works fine.
As soon as the record created via Kobocollect was ‘manually’ updated via Enketo, the code works as well.

Does this give anyone any ideas?

I also have the same problem, and indeed when I edit the submission with enketo via the UI, then use the API it work, but for the data that is not yet edited via enketo, the api doesn’t work

Has there been any resolution on this? We are having the same problem with our KoboToolbox instance. We want to bulk update our records but the API is failing due to reasons highlighted in this thread (producing error 500 especially for records submitted from the mobile app). Any help on this?