Creating the issue with assigning the customer as the reporter with Jira API

I would like to create new customer if it does not exist and create new issue setting this reporter as customer in PHP with JIra API. I am trying do this in this way:

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');

$postvars = array('fields' => array('project' => array('key' => 'AP'), 'summary' => $body, 'description' => $body, 'reporter' => null));

$postvars['fields']['issuetype'] = array("id" => '10108');
$postvars['fields']['reporter']['fullName'] = $name; //POST field of customer's name to set customer as the reporter of new issue
$postvars['fields']['reporter']['email'] = $email; //POST field of customer's email address to set customer as the reporter of new issue

curl_setopt($ch, CURLOPT_URL, 'https://jira-address/rest/servicedeskapi/customer');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'X-ExperimentalApi: opt-in'));
curl_setopt($ch, CURLOPT_POSTFIELDS,
json_encode(array('fullName' => $reporterName, 'email' => $email))); //POST fields for creating new customer
$r = curl_exec($ch); //sending request for creating new customer
echo json_encode(json_decode($r), JSON_PRETTY_PRINT); //printing response of request for creating new customer

curl_setopt($ch, CURLOPT_URL, 'https://jira-address/rest/api/2/issue/');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postvars));
$r = curl_exec($ch); //sending request for creating new issue
echo json_encode($postvars, JSON_PRETTY_PRINT); //printing POST fields of the request of creating new issue
echo json_encode(json_decode($r), JSON_PRETTY_PRINT); //printing the response of the request for creating new issue

If the customer does not exist, the response is:

    "name": "",
    "key": "",
    "emailAddress": "",
    "displayName": "kamilszmit2",
    "active": true,
    "timeZone": "Europe\/Warsaw",
    "_links": {
        "jiraRest": "https:\/\/jira-address\/rest\/api\/2\/user?",
        "avatarUrls": {
            "48x48": "https:\/\/jira-address\/secure\/useravatar?avatarId=10122",
            "24x24": "https:\/\/jira-address\/secure\/useravatar?size=small&avatarId=10122",
            "16x16": "https:\/\/jira-address\/secure\/useravatar?size=xsmall&avatarId=10122",
            "32x32": "https:\/\/jira-address\/secure\/useravatar?size=medium&avatarId=10122"
        "self": "https:\/\/jira-address\/rest\/api\/2\/user?"
    "fields": {
        "project": {
            "key": "AP"
        "summary": "test",
        "description": "test",
        "reporter": {
            "fullName": "kamilszmit2",
            "email": ""
        "issuetype": {
            "id": "10108"
    "id": "11187",
    "key": "AP-351",
    "self": "https:\/\/jira-address\/rest\/api\/2\/issue\/11187"

I create new customer using API ‘servicedeskapi/customer’ with POST fields ‘fullName’ and ‘email’ and then I create new issue using API ‘api/2/issue’ with parameters ‘fullName’ and ‘email’ of parameter ‘reporter’. New customer and new issue are created but new customer is not set as the reporter of this issue in Jira. The same problem occurs if customer already exists and when only the parameter ‘fullName’ or ‘email’ of the parameter ‘reporter’ is used.

What am I doing wrong? How to create Jira issue with the customer as the reporter? Could you help me?

You need to use a different api:

Although Jira Service Management tickets are Jira issues, the Jira API is not aware of the concept of a Customer. This lies solely within the domain of Jira Service Management