POST DataElements in Python (Django)

Hi All

I am trying to created Data elements in DHIS2.32 via Web API using the code below. Unfortunately i am getting ERROR 500

    for value in storedMetaFields.values(): 
        url = 'http://x.x.x.x:8080/api/dataElements'
        headers = {'Content-type': 'application/json'}
        shortName = value

        if len(shortName) > 50:
            print('ShortName Too Long:'+ " "+shortName)  
            shortName = shortName[0:49]                                       

        dataElement = {
        'aggregationType' : 'SUM',
        'domainType': 'TRACKER',
        'categoryCombo': 'bjDvmb4bfup', 
        'valueType': 'TEXT',
        'zeroIsSignificant': 'true',
        'name': shortName,

        r =, data=json.dumps(dataElement), headers=headers,auth=HTTPBasicAuth(settings.DHIS2_USER, settings.DHIS2_PASSWORD))

Many thanks

Getting the following error in Postman

“httpStatus”: “Internal Server Error”,
“httpStatusCode”: 500,
“status”: “ERROR”,
“message”: “Cannot construct instance of org.hisp.dhis.category.CategoryCombo (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value (‘bjDvmb4bfuf’)\n at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 4, column: 34] (through reference chain: org.hisp.dhis.dataelement.DataElement[“categoryCombo”])”

Removing the ‘categoryCombo’: ‘bjDvmb4bfup’, did the trick

dataElement = {
“aggregationType” : “SUM”,
“domainType”: “TRACKER”,
“valueType”: “TEXT”,
“zeroIsSignificant”: “true”,
“name”: shortName,