Good afternoon. I am trying to create a Ticket with PHP Curl (REST) but I am having serious problems to understand this.
1. I NEED TO ACCESS THE VIA ULR SERVICE BUT I'M NOT GETTING IT;
2. I AM CREATING A FORM IN PHP AND I RECEIVE THE DATA CREATING A JSON AND SENDING TO THE WEBSERVICE, THE TICKET SHOULD BE CREATED.
3. HOW TO CONFIGURE THE CURL FOR POST AND GET?
4. WHAT SHOULD BE THE ADDRESS TO ACCESS THE SERVICE?
Tank's
******************************************************
MY CODE
******************************************************
$userpasswd = "username:password";
$url = "http://my URL";
$json = "{\"Ticket\":{\"Title\":\"REST Create Test\", \"Type\": \"Unclassified\", \"Queue\":\"Raw\",\"State\":\"open\",\"Priority\":\"3 normal\",\"CustomerUser\":\"customer\"},\"Article\":{\"Subject\":\"Rest Create Test\",\"Body\":\"This is only a test\",\"ContentType\":\"text/plain; charset=utf8\"}}";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_USERPWD, $userpasswd);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt($ch, CURLOPT_POST, 1);
$result = curl_exec($ch);
curl_close ($ch);
Create ticket with PHP curl (REST)
-
- Znuny newbie
- Posts: 1
- Joined: 24 Aug 2017, 20:27
- Znuny Version: OTRS 5.0
- Real Name: Alessandro Porto
- Company: Obsidium
-
- Znuny newbie
- Posts: 38
- Joined: 16 Aug 2017, 11:26
- Znuny Version: OTRS 5
- Real Name: sameer sardar
- Company: ENS
Re: Create ticket with PHP curl (REST)
hey,
if im not wrong , Your requirement is to get ticket in OTRS from an external form , is it ??
so basically you're posting data from that page, is it ??
if im not wrong , Your requirement is to get ticket in OTRS from an external form , is it ??
so basically you're posting data from that page, is it ??
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Create ticket with PHP curl (REST)
Maybe https://github.com/rkaldung/otrs-gi-res ... client.php is a good start for you...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de