How to upload a new record to Kobo using python?

Hi I need to load a large number of records for a form and I want to use python.
Could you provide me with a piece of code using the POST method from python?
Is it possible to use something like this?

TOKEN = token_kobo
PARAMS = {‘format’: ‘json’}
HEADERS = {‘Authorization’: f’Token {TOKEN}’}
URL = ‘https://kobo.humanitarianresponse.info/api/v2/assets/’+asset+’/data/bulk/
payload = {‘submission_ids’: [submission_id], ‘data’: {grupo_preg : valor_nuevo}}
res = requests.post(url= URL, data= {‘payload’: json.dumps(payload)}, params= PARAMS, headers= HEADERS)

What I want to do is create new records for a form.

Thank you so much by the help you could provide me.

Hi @Akratos, you can refer to the thread here for some guidance:

1 Like