POST api/Activity/CreateAttributeTemplate
This is a helper method you can use to get all the fields required for adding requisition lines, cost lines and comments to an activity. For example if you want to add an requisition line the documentation states that you have to add fields models for RequisitionType, PartNumber and Quantity and that the RequisitionType must be picked from a lookup. By using this method and specifying that you want to create a requisition line we will return an array consisting of fields models for these tree fields. The requisition type field will be set up with correct argument for the LookupController.GetLookupValues(LookupController.GetLookupArgumentModel)
Examples
Get fields required for adding a requisition line
//Setup the CreateActivityArgumentModel
var arg = {
TicketId :'7ECEB7B7-B533-492D-8321-E92D198551AF'
CombinedActvityId : "sesam10:1234567"
AttributeType : 5 // RequisitionLine
};
//Make Ajax call
$.ajax({
url: 'https://api.infocare.com/api/Activity/CreateAttributeTemplate',
type: "POST",
data: JSON.stringify(arg),
contentType: "application/json;charset=utf-8"
})
Request Information
URI Parameters
None.
Body Parameters
Specify which activity and what kind of object you want to add
AttributeTemplateArgumentModel| Name | Description | Type | Additional information |
|---|---|---|---|
| AdditionalId |
Gets or sets an additional id that may required for some of the attribute types
|
string |
None. |
| AttributeType |
Gets or sets the attribute type, please note that we only support RequisitionLine, Comment, CostLine, ScheduleFail and ScheduleDelay |
AttributeTypes |
None. |
| CombinedActivityId |
Get or set combined activity id |
string |
None. |
| FormName |
Gets or sets the optional FormName. The FormName is used to limit the number of fields returned from GetActivity. |
string |
None. |
| TicketId |
Gets or sets the ticket id |
string |
None. |
| Culture |
Gets or sets culture, if not specified we will use culture set on user. |
string |
None. |
Request Formats
application/json, text/json
{
"AdditionalId": "sample string 1",
"AttributeType": 0,
"CombinedActivityId": "sample string 2",
"FormName": "sample string 3",
"TicketId": "sample string 4",
"Culture": "sample string 5"
}
application/xml, text/xml
<ActivityController.AttributeTemplateArgumentModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Controllers">
<Culture xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 5</Culture>
<TicketId xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 4</TicketId>
<CombinedActivityId xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 2</CombinedActivityId>
<FormName xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 3</FormName>
<AdditionalId>sample string 1</AdditionalId>
<AttributeType>Field</AttributeType>
</ActivityController.AttributeTemplateArgumentModel>
application/x-www-form-urlencoded
Response Information
Resource Description
a field model you can use to add the requested object
AttributeTemplateReturnModel| Name | Description | Type | Additional information |
|---|---|---|---|
| TemplateFields |
Gets or sets the template fields |
Collection of AttributeUpdateModel |
None. |
| CombinedPerformanceId |
Gets or sets the performance id. If performance monitoring is not turned on this property will not be present or set to null |
string |
Json null value handling: Ignore |
Response Formats
application/json, text/json
{
"TemplateFields": [
{
"AttributeName": "sample string 1",
"AttributeAction": 0,
"AttributeType": 0,
"AttributeTransaction": "sample string 2",
"AttributeData": {}
},
{
"AttributeName": "sample string 1",
"AttributeAction": 0,
"AttributeType": 0,
"AttributeTransaction": "sample string 2",
"AttributeData": {}
}
],
"CombinedPerformanceId": "sample string 1"
}
application/xml, text/xml
<ActivityController.AttributeTemplateReturnModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Rostov.Controllers">
<CombinedPerformanceId xmlns="http://schemas.datacontract.org/2004/07/Rostov.Models">sample string 1</CombinedPerformanceId>
<TemplateFields xmlns:d2p1="http://schemas.datacontract.org/2004/07/Rostov.Models">
<d2p1:AttributeUpdateModel>
<d2p1:AttributeAction>Add</d2p1:AttributeAction>
<d2p1:AttributeData />
<d2p1:AttributeName>sample string 1</d2p1:AttributeName>
<d2p1:AttributeTransaction>sample string 2</d2p1:AttributeTransaction>
<d2p1:AttributeType>Field</d2p1:AttributeType>
</d2p1:AttributeUpdateModel>
<d2p1:AttributeUpdateModel>
<d2p1:AttributeAction>Add</d2p1:AttributeAction>
<d2p1:AttributeData />
<d2p1:AttributeName>sample string 1</d2p1:AttributeName>
<d2p1:AttributeTransaction>sample string 2</d2p1:AttributeTransaction>
<d2p1:AttributeType>Field</d2p1:AttributeType>
</d2p1:AttributeUpdateModel>
</TemplateFields>
</ActivityController.AttributeTemplateReturnModel>