Updated or creates a feature in a feature set

Features are aspects of entities about which sentiment should be captured. Each feature can have one or more expressions to match. Expressions are essentially synonyms that refer to the same concept. Expressions are specified as a JSON object in the message body containing a property "expressions" that takes a string array value. A non-matching expression can be specified with a leading tilde (~). Example:
"expressions": ["case", "~in case"]
Would match "The iPhone case is great" but not "I bought the warranty just in case it breaks".

If the feature set name specified in the URL does not exist, a new feature set by that name is created.

If a feature exists in the specified feature set with the same feature name given in the URL, that feature's expressions will be overwritten.

$obj = array(
  "expressions" => array("nlp", "natural language processing")
);

$options = array(
  'http' => array(
    'method'  => 'PUT',
    'content' => json_encode($obj),
    'header'=>  "Content-Type: application/json\r\n" .
                "Accept: application/json\r\n"
    )
);

$context  = stream_context_create($options);
$result = file_get_contents("http://api.addstructure.com/v1/analysis/featuresets/demo/features/nlp?key=APIKEY", false, $context);
echo($result);
Language