Updated or creates an entity in a feature set

Entities are people, places, or things about which sentiment should be captured. Each entity 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 an entity exists in the specified feature set with the same entity name given in the URL, that entity's expressions will be overwritten.

$obj = array(
  "expressions" => array("ms", "microsoft")
);

$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/entities/microsoft?key=APIKEY", false, $context);
echo($result);
Language