You are not logged in.
Pages: 1
Hello!
I am trying to create an ITILCategory using the code bellow:
baseURL = "https://glpi.somedomain.com"
apiToken = "xxxxxx"
usrToken = "xxxxxx"
url = baseURL + '/apirest.php/ITILCategory'
print(url)
headers = {
'App-Token': apiToken,
'Content-Type': 'application/json',
'Session-Token': sSessionToken
}
body = {
"input": {
#"id":1,
"entities_id":0,
"is_recursive":1,
"itilcategories_id":0,
"name":"teste",
"completename":"teste",
"comment":"",
"level":1,
"knowbaseitemcategories_id":0,
"users_id":0,
"groups_id":10,
"code":"",
"ancestors_cache":"[]",
"sons_cache":0,
"is_helpdeskvisible":1,
"tickettemplates_id_incident":1,
"tickettemplates_id_demand":1,
"changetemplates_id":1,
"problemtemplates_id":1,
"is_incident":1,
"is_request":1,
"is_problem":1,
"is_change":1,
}
}
sResult = requests.post(url,headers=headers,data=body)
I ommited the initsession part of the code. I am getting the following error:
"'["ERROR_JSON_PAYLOAD_INVALID","JSON payload seems not valid"]"
Does anybody has any idea?
Thanks
Offline
Does your "id" property have this "#" before it in its actual request? This would not be valid as the JSON specification has no way of specifying comments.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
Pages: 1