title: "message":"The given id must not be null!; nested exception is java.lang.IllegalArgumentException: The given id must not be null!","code":500
body: <p>I have modal, there is a form inside the modal, after filling out the fields, I try to console the data. </p>
  
  <p>I can see that all the data is correct. But the problem is in inserting.</p>
  
  <p>This is my code in inserting of data : </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    let data = {
        "blockDates": blockdates,
        "location": location,
        "photos": cardphotos,
        "videos": cardvideos,
        "unit": unit,
        "title": title,
        "catalogId": catalogId,
        "categoryId": categoryId,
        "subcategoryId": subcategoryId,
        "countryId": countryId,
        "provinceId": provinceId,
        "localityIds": localityIds,
        "contentOptions": contentOptions,
        "themeIds": themeIds,
        "why": why,
        "description": description,
        "cancellationPolicy": cancellationPolicy,
        "displayPrice": displayPrice,
        "displayDiscounted": displayDiscounted,
        "displayMaxPax": displayMaxPax
      };
  
      console.log(data);
  
      let content = ajax("api/unitContents", JSON.stringify(data), "POST");
      //insert
      // let contentId = null;
      content = content.done(e =&gt; {
        console.log(content);
      }).fail(e =&gt; {
        console.log(content);
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>this is my global ajax function for api</p>
  
  <pre><code>  ajax = (action, data, method) =&gt; {
  return $.ajax({
    type: method,
    url: `myAPI/${action}`,
    contentType: 'application/json',
    beforeSend: function (xhr) {
      xhr.setRequestHeader("Authorization", `Bearer ${gon.global.currentUser.access_token}`);
    },
    data: data,
    async: !1,
    cache: false,
    error: function (e) {
      console.log(e.responseText);
      console.log("Error occured");
    }
  });};
  </code></pre>
  
  <p>what are the possible cause of that error?</p>