/
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" ] }
Property | Description |
---|---|
Type | The type of the attribute. Possible values are Undefined, Text or Pickllist |
Name | The name of the attribute |
Values | An 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); }