$subject, 'customField2' => $customer_name, 'customField3' => $customer_address, 'customField4' => $customer_phone_number, 'customField5' => $customer_email, 'customField6' => $customer_number, 'customField7' => $customer_service_pin, 'description' => [ 'raw' => $description ] ]; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://project.xinon.at/api/v3/projects/10/work_packages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode($data), CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_USERPWD => 'apikey:'.$apiKey )); curl_setopt($curl, CURLOPT_USERPWD, 'apikey:'.$apiKey); $response = curl_exec($curl); curl_close($curl); return $response; } /** * Search for support tickets using a global search in Xinon OpenProject. * @param string $search - The search query. * @param int $pageSize - The number of results to return. * @return array - The search results. */ public function searchSupportTickets(string $search, int $pageSize = 25, $overrideQueryParams = null): array { $curl = curl_init(); $baseUrl = 'https://project.xinon.at/api/v3/projects/10/work_packages'; $queryParams = ['pageSize' => $pageSize, 'filters' => json_encode([['search' => ['operator' => '**', 'values' => [$search]]]])]; if (!is_null($overrideQueryParams)) $queryParams = $overrideQueryParams; curl_setopt_array($curl, array( CURLOPT_URL => $baseUrl . '?' . http_build_query($queryParams), CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array('Content-Type: application/json'), CURLOPT_USERPWD => 'apikey:' . PROJECT_API_KEY )); $response = curl_exec($curl); curl_close($curl); $json = json_decode($response, true); return $json['_embedded']['elements']; } } ?>