/
Adding attributes to a sentence

Adding attributes to a sentence

Attributes are added to a sentence using the POST request to <host>/Congree/api/AuthoringMemory/v1/Sentences/<sentenceID>/Attributes.

<sentenceID> is the ID of the sentence you want to assign an attribute to.

To be able to assign attributes to a sentence they must have been defined (Defining Attributes).

The body of the request contains a JSON object specififying the attribute(s) to be assigned.  The attributes are items of an object array. The structure of the JSON object is shown below:

[
  {
    "Name": "string",
    "Values": [
      "string"
    ]
  }
]
PropertyDescription
NameThe name of the attribute
ValuesAn array of string values
stringthe actual value(s)

Let's assume we want to assign the attribute "ProductGroup" with a value of "Authoring Memory" to a sentence. The body would contain this JSON object:

[
  {
    "Name": "ProductGroup",
    "Values": [
      "Authoring Memory"
    ]
  }
]

A method assigning attributes to a sentence could look like this:

private void AddAttribute(string host, string token, string sentenceId, string body){
	var client = new RestClient(host + "/Congree/api/AuthoringMemory/v1/Sentences/" + sentenceId + "/Attributes");
	client.Timeout = -1;
	var request = new RestRequest(Method.POST);
	request.AddHeader("Authorization", "Bearer " + token);
	request.AddHeader("Content-Type", "application/json");

	request.AddParameter("application/json", body,  ParameterType.RequestBody);
	IRestResponse response = client.Execute(request);
}

Related content

Adding attributes to a sentence
Adding attributes to a sentence
More like this
Defining Attributes
Defining Attributes
More like this
Defining Attributes
Defining Attributes
More like this
Finding sentences by attribute value
Finding sentences by attribute value
More like this
Finding sentences by attribute value
Finding sentences by attribute value
More like this
AuthoringMemory
AuthoringMemory
More like this