What is the REST API parameter to specify a web custom field value?
In Legacy API it was:
custom.field.<id> = value
How is it in assyst REST API?
What is the REST API parameter to specify a web custom field value?
In Legacy API it was:
custom.field.<id> = value
How is it in assyst REST API?
See https://wiki.axiossystems.com/assyst11-6Wiki/index.php/Integrations:assystREST_More_Examples#Request_Format . You can use IDs, or you can identify the custom field by short code.
{
"eventTypeEnum": "INCIDENT",
"importProfile": {
"resolvingParameters": s
{
"parameterName": "shortCode",
"parameterValue": "PROFILEEXAMPLE"
}
]
},
"affectedUserName": "Jonh",
"affectedUserTelephone": "+55 27 1234-5678",
"categoryId": 123,
"itemAId": 12345,
"remarks": "Lorem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum.",
"csgId": 1,
"entityDefinitionId": 12,
"customFields": s
{
"stringValue": "Rua X",
"customFieldShortCode": "ADDRESS",
"customFieldId": 999,
"customFieldType": 1
},
{
"stringValue": "Serra",
"customFieldShortCode": "CITY",
"customFieldId": 888,
"customFieldType": 1
}
]
}
public class IncidentExample: IAssystGenerico, IAlteravelEJB
{
JsonProperty("eventTypeEnum")]
public string EventTypeEnum { get; set; }
JsonProperty("importProfile")]
public ImportProfile ImportProfile { get; set; }
JsonProperty("affectedUserName")]
public string AffectedUserName { get; set; }
JsonProperty("affectedUserTelephone")]
public string AffectedUserTelephone { get; set; }
JsonProperty("affectedUserEmail")]
public string AffectedUserEmail { get; set; }
JsonProperty("category")]
public Category Category { get; set; }
JsonProperty("itemA")]
public ItemA ItemA { get; set; }
JsonProperty("remarks")]
public string Remarks { get; set; }
JsonProperty("shortDescription")]
public string ShortDescription { get; set; }
JsonProperty("callbackRemark")]
public string CallbackRemark { get; set; }
JsonProperty("csg")]
public CSG CSG { get; set; }
JsonProperty("customEntityDefinition")]
public CustomEntityDefinition CustomEntityDefinition { get; set; }
JsonProperty("customFields")]
public CustomFieldm] CustomFields { get; set; }
}
JsonObject("resolvingParameters")]
public class ResolvingParameters
{
JsonProperty("parameterName")]
public string ParameterName { get; set; }
JsonProperty("parameterValue")]
public string ParameterValue { get; set; }
}
JsonObject("importProfile")]
public class ImportProfile
{
JsonProperty("resolvingParameters")]
public ResolvingParametersm] Parameters { get; set; }
}
JsonObject("customEntityDefinition")]
public class CustomEntityDefinition
{
JsonProperty("resolvingParameters")]
public ResolvingParametersm] Parameters { get; set; }
}
JsonObject("category")]
public class Category
{
JsonProperty("resolvingParameters")]
public ResolvingParametersm] Parameters { get; set; }
}
JsonObject("csg")]
public class CSG
{
JsonProperty("resolvingParameters")]
public ResolvingParametersm] Parameters { get; set; }
}
JsonObject("itemA")]
public class ItemA
{
JsonProperty("resolvingParameters")]
public ResolvingParametersm] Parameters { get; set; }
}
JsonObject("customFields")]
public class CustomField
{
JsonProperty("stringValue")]
public string StringValue { get; set; }
JsonProperty("customFieldShortCode")]
public string CustomFieldShortCode { get; set; }
JsonProperty("customFieldId")]
public int CustomFieldId { get; set; }
JsonProperty("customFieldType")]
public int CustomFieldType { get; set; }
}
public void RegisterEventInAssyst(){
IncidentExample eventObj = new IncidentExample()
{
EventTypeEnum = "INCIDENT",
AffectedUserName = "Jonh",
AffectedUserTelephone = "+55 27 1234-5678",
AffectedUserEmail = "test@test.com",
Remarks = "Lorem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum.",
ShortDescription = "Excerpt",
CallbackRemark = "test@test.com",
CSG = new CSG()
{
Parameters = new ResolvingParametersm]
{
new ResolvingParameters()
{
ParameterName = "shortCode",
ParameterValue = "CSGNAME"
}
}
},
ImportProfile = new ImportProfile()
{
Parameters = new ResolvingParametersm]
{
new ResolvingParameters()
{
ParameterName = "shortCode",
ParameterValue = "PROFILEEXAMPLE"
}
}
},
CustomEntityDefinition = new CustomEntityDefinition()
{
Parameters = new ResolvingParametersm]
{
new ResolvingParameters()
{
ParameterName = "shortCode",
ParameterValue = "CUSTOMENTITYNAME"
}
}
},
Category = new Category()
{
Parameters = new ResolvingParametersm]
{
new ResolvingParameters()
{
ParameterName = "shortCode",
ParameterValue = "CATEGORYNAME"
}
}
},
ItemA = new ItemA()
{
Parameters = new ResolvingParametersm]
{
new ResolvingParameters()
{
ParameterName = "shortCode",
ParameterValue = "ITEMANAME"
}
}
},
CustomFields = new CustomFieldm]
{
new CustomField()
{
StringValue = "Rua X",
CustomFieldShortCode = "ADDRESSNAME",
CustomFieldId = 999,
CustomFieldType = 1
}
}
};
using (var client = new HttpClient()){
string urlRelativa = "/assystREST/v2/events";
client.BaseAddress = "https://url-base";
client.DefaultRequestHeaders.Add("X-CSRF-Header", String.Empty);
client.DefaultRequestHeaders.Add("Accept", "application/json");
string entidade1 = Newtonsoft.Json.JsonConvert.SerializeObject(eventObj);
StringContent entidade2 = new StringContent(entidade1, System.Text.Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync(urlRelativa, entidade2).Result;
if (response.IsSuccessStatusCode){
var stringResponse = response.Content.ReadAsStringAsync().Result;
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.