Search code examples
pythonpython-3.xapizabbix

How to use post type as form data in Python using Zabbix Api


I'm using the below script to create a form but its creating step scene as raw data. I tried to select post type as Form data in step but it is not working as expected. Please guide me. Any help will be appreciated.

enter image description here

code:

http = self.zapi.httptest.create(name = web_data,hostid=hostid,delay='2m',applicationid=appid,
            steps=[{'name':web_data,'url':web_data,'status_codes':'200','posts':['name','','value',''],'no':1}])

Solution

  • You need to use 'array of HTTP fields', but you are using an array. Try with:

    'posts': [
      {'name': 'the field', 'value': 'the content'},
      {'name': 'another field', 'value': 'another content'}
    ]
    

    Documentation: httptest/object