/
Defining Attributes

Defining Attributes

Attribute that shall be assigned to sentences in the Authoring Memory must be defined first.

The endpoint to define attributes, i.e. to make them known and usable within the Authoring Memory is : <host>/Congree/Congree/api/AuthoringMemory/v1/Attributes

The attribute to be defined is passed as a JSON object in the body.

{
  "Type": "Undefined",
  "Name": "string",
  "Values": [
    "string"
  ]
}
PropertyDescription
TypeThe type of the attribute. Possible values are Undefined, Text or Pickllist
NameThe name of the attribute
ValuesAn array of possible values

Let's assume we want to add an attribute allowing us to store the ID of a module coming from a CMS. To be able to do so we define an attribute Module-ID. 

The object passed in this request is the following:

{
  "Type": "Text",
  "Name": "Module-ID"
}

The method to store the new attribute definition:

public void StoreAttributeDefintion(string host, string token, string definition){
	var client = new RestClient(host + "/Congree/api/AuthoringMemory/v1/Attributes");
	client.Timeout = -1;
	var request = new RestRequest(Method.POST);
	request.AddHeader("Authorization", "Bearer 	+ token);
	request.AddHeader("Content-Type", "application/json");
	var body = definition;
	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
Adding attributes to a sentence
Adding attributes to a sentence
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
Storing XML files
Storing XML files
More like this
Storing XML files
Storing XML files
More like this