Custom Triger Add a Request

Custom Triger Add a Request

Hi we are using the SDP MSK Version 9208. We want  to run a custom script (python) when a request is closed. The script is below and the proble is that we are receiving the message when scripts runs ..
Action Executed is : Νέο Δελτιο τιμολόγησης
Message:  Session request submitted successfully{'operation': {'result': {'status': 'Failed', 'message': "Mandatory element 'account' not found"}}} "data={\n \"operation\": {\n \"details\": {\n\t\t\t\"account\":\"ANACHEM\",\n \"title\": \"descrf\",\n \"priority\": \"high\",\n \"description\": \"descrf\",\n\t\t\t\"requester\":\"Mika\",\n\t\t\t\"site\":\"Anachem\"\n\t\t\t\n\t\t\t\n }\n }\n}" ******************* data={ "operation": { "details": { "account":"ANACHEM", "title": "descrf", "priority": "high", "description": "descrf", "requester":"Mika", "site":"Anachem" } } } 


The Account Name is correct and exist 
can  anyone help me !!!!
  1. import requests
  2. import sys
  3. import json
  4. import datetime
  5. from pprint import pprint

  6. TechnicianKey='my admin key'
  7. OperationName='ADD_REQUEST'
  8. filename = str(sys.argv[1])
  9. with open(filename,encoding='UTF8') as data_file:
  10.     data = json.load(data_file)
  11. request_Obj = data['request']
  12. REQUESTER=request_Obj['REQUESTER']
  13. SUBJECT=request_Obj['SUBJECT']
  14. SITE=request_Obj['SITE']
  15. DESCRIPTION=request_Obj['DESCRIPTION']
  16. SHORTDESCRIPTION=request_Obj['SHORTDESCRIPTION']
  17. CREATEDTIME = request_Obj['CREATEDTIME']
  18. scheduledstarttime = datetime.datetime.fromtimestamp(int(CREATEDTIME) / 1e3).strftime('%d %b %Y, %H:%M:%S')

  19. with requests.Session() as s:
  20.     url = "http://MY-IP:My-Port"
  21. jsonData ='''data={
  22.     "operation": {
  23.         "details": {
  24. "account":"ANACHEM",
  25.             "title": "'''+SHORTDESCRIPTION+'''",
  26.             "priority": "high",
  27.             "description": "'''+DESCRIPTION+'''",
  28. "requester":"'''+REQUESTER+'''",
  29. "site":"'''+SITE+'''"
  30.         }
  31.     }
  32. }'''

  33. json_data = json.dumps(jsonData)

  34. apprUrl = url + "/sdpapi/request/"
  35. data = {'INPUT_DATA' : json_data ,'TECHNICIAN_KEY': TechnicianKey,'format':'json','OPERATION_NAME':OperationName}
  36. r = s.post(apprUrl,data)

  37. if(r.status_code == 200):
  38.   print("Session request submitted successfully")
  39.   print(r.json())
  40.   print(json_data)
  41.   print("*******************")
  42.   print(jsonData)  
  43. else :
  44.   print("Problem submitting session request")
  45.   print(r.json())
  46.   print(json_data)
  47.   print("*******************")
  48.   print(jsonData)  
                New to ADManager Plus?

                  New to ADSelfService Plus?