You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2019-11-20 20:15:38

giogama
Member
Registered: 2019-11-20
Posts: 4

Create Ticket Using Api doesn't send notification

I'm using the API Rest to create a Ticket. The ticket has been created perfectly. But noone (requester, watcher) is receiving the e-mails.

I've made a test, I created a Ticket Test using the Aplicacation and everybody receives the notification (email) correctly.

Below is the Json I have used to create the ticket using the API

{ "name", "TEST" }, { "users_id", 21 }, { "type", 1 }, { "entities_id", 0 }, { "requesttypes_id", 1 }, { "status", 2 }, { "content", "Created by api " + DateTime.Now.ToLongDateString() }

Does Somebody know what can be happing here?

Thanks!!

Offline

#2 2019-11-20 20:28:05

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: Create Ticket Using Api doesn't send notification

after ticket has been created, have an requester assigned?

Offline

#3 2019-11-20 20:46:49

giogama
Member
Registered: 2019-11-20
Posts: 4

Re: Create Ticket Using Api doesn't send notification

After I created the ticket, I created the Requester (type=1) using the API as well

API Url: Ticket/{ticketId}/Ticket_User

Json used

{ "tickets_id", {ticketId} }, { "users_id", 21 }, { "type", 1 }, { "use_notification", "1" }

Offline

#4 2019-11-20 20:58:58

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: Create Ticket Using Api doesn't send notification

the field "type" is used for assign the ticket type (incident or request).

use this URL and try to use your json like this:

http://yourIPGLPI/apirest.php/Ticket/

curl -X POST \
  http://yourIPGLPI/apirest.php/Ticket/ \
  -H 'App-Token: your app-token' \
  -H 'Content-Type: application/json' \
  -H 'Session-Token: your sess-token' \
  -d '
{
    "input": {
"users_id":587, user_id author (who are opening the ticket)
"type":1, //this is for incident
"itilcategories_id":112, //id of ticket category
"requesttypes_id":6,
"urgency":5,
"impact":5,
"priority":5,
"name":"title of the ticket",
"content":"description of the ticket"

            }
}
'

Now to you automatically assign an observer or a requester to the ticket, create a business rule for ticket, based on criterions and actions that you need

Offline

#5 2019-11-20 21:44:17

giogama
Member
Registered: 2019-11-20
Posts: 4

Re: Create Ticket Using Api doesn't send notification

I've created the Ticket as you said and put a Requester as well (using API).

But, I don't receive any notification by e-mail.


Now, the strange thing is, When I create a Ticket using de Application GLPI, the same Ticket information, I receive the e-mail notification. This is my headache.

Thanks!!

Offline

#6 2019-11-20 21:55:44

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: Create Ticket Using Api doesn't send notification

Look at Administration > Notifications queue

Have some register there?

Look too in the Notification > Email Followups Configuration

The admin email are correctly setup here?

I think some target's role missing ..

Offline

#7 2019-11-20 22:00:48

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: Create Ticket Using Api doesn't send notification

Are you using Linux?

Offline

#8 2019-11-20 22:01:58

mecmav
Member
From: Brasil
Registered: 2019-03-22
Posts: 330

Re: Create Ticket Using Api doesn't send notification

If using Linux, try to view the log of the emails.

/var/www/glpi/files/_log/mail.log
and
/var/www/glpi/files/_log/mail-debug.log

on these files you can analyze what causing not deliver emails

Offline

#9 2019-11-21 09:55:23

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,287

Re: Create Ticket Using Api doesn't send notification

when you create a ticket, glpi sends notifications to requester (event new ticket). at this time, requester is not assigned, so notification can not be send to requester.

What I Would do :  set requester in the first JSON ( create ticket)

{ "input": 
      { "entities_id": "2", 
         "name": "Demande d'infos", 
         "_users_id_assign": 6, 
         "_user_id_request": 15,
         "requesttypes_id": 7,
         "content": "Je voudrais avoir des infos concernant la problématique.....",
         "urgency": 3, 
         "impact": 3,
        "priority": 3,
        "itilcategories_id": 189, 
        "time_to_resolve": "2018-09-24 12:00:00",
         "type": 2 
         }
 }

Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9

Offline

#10 2022-12-20 14:21:04

ddgame
Member
Registered: 2022-12-20
Posts: 2

Re: Create Ticket Using Api doesn't send notification

Will be useful: correct parameter name is "_users_id_requester", at least in my 10.0.3 version. You have a mistake.

Offline

#11 2022-12-20 14:23:06

ddgame
Member
Registered: 2022-12-20
Posts: 2

Re: Create Ticket Using Api doesn't send notification

_users_id_requester

LaDenrée wrote:

when you create a ticket, glpi sends notifications to requester (event new ticket). at this time, requester is not assigned, so notification can not be send to requester.

What I Would do :  set requester in the first JSON ( create ticket)

{ "input": 
      { "entities_id": "2", 
         "name": "Demande d'infos", 
         "_users_id_assign": 6, 
         "_user_id_request": 15,
         "requesttypes_id": 7,
         "content": "Je voudrais avoir des infos concernant la problématique.....",
         "urgency": 3, 
         "impact": 3,
        "priority": 3,
        "itilcategories_id": 189, 
        "time_to_resolve": "2018-09-24 12:00:00",
         "type": 2 
         }
 }

Offline

Board footer

Powered by FluxBB