KBEC-00492 - Create Property with Very Long Value in Command Line

Article ID:360060575111
1 minute readKnowledge base
On this page


The command that creates a property fails when the value is very long. For example, when the value is 8,000 characters long, the command fails with the following error:

hhuang@ubuntu1604:~$ curl -u admin:changeme -kX POST "" -H  "accept: application/json" -d "{}"
<h1>Bad Message 431</h1><pre>reason: Request Header Fields Too Large</pre>hhuang@ubuntu1604:~$

When the value is 10,000 characters long, the command fails with a different error:

ohhuang@ubuntu1604:~$ curl -u admin:changeme -kX POST "" -H  "accept: application/json" -d "{}"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="https://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<title>Submitted URI too large!</title>
<link rev="made" href="mailto:you@example.com" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}

<h1>Submitted URI too large!</h1>

    The length of the requested URL exceeds the capacity limit for
	this server. The request cannot be processed.

If you think this is a server error, please contact
the <a href="mailto:you@example.com">webmaster</a>.


<h2>Error 414</h2>
  <a href="/">localhost</a><br />
  <span>Apache/2.4.43 (Unix) OpenSSL/1.1.1g mod_auth_kerb/5.4 PHP/7.4.6</span>



As we can see from the command, this is actually a POST request to the CD server. So we can send the parameters in the body of the request in JSON format instead of the querystring. The following is an example command (please replace PROPERTY_VALUE with the long string when you try it).

curl -u admin:changeme -kX POST "" -H  "accept: application/json" -d "{\"propertyName\":\"valueIs10k\", \"procedureName\":\"zd188338\", \"projectName\":\"original_Test\", \"value\":\"PROPERTY_VALUE\"}"