Skip to main content
Solved

What is the REST API parameter to specify a web custom field value?


lucascaetano
Do Gooder
Forum|alt.badge.img

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?

Best answer by Paul McCulloch

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.

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+10
  • Hero (Employee)
  • 67 replies
  • Answer
  • March 20, 2023

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.


lucascaetano
Do Gooder
Forum|alt.badge.img
  • Author
  • Do Gooder
  • 1 reply
  • March 20, 2023

 

AssystREST Post:

 

 

JSON Example:
 

{
    "eventTypeEnum": "INCIDENT",
    "importProfile": {
        "resolvingParameters": [
            {
                "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": [
        {
            "stringValue": "Rua X",
            "customFieldShortCode": "ADDRESS",
            "customFieldId": 999,
            "customFieldType": 1
        },
        {
            "stringValue": "Serra",
            "customFieldShortCode": "CITY",
            "customFieldId": 888,
            "customFieldType": 1
        }
    ]
}

 

C# Example:

 



        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 CustomField[] 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 ResolvingParameters[] Parameters { get; set; }

        }

        [JsonObject("customEntityDefinition")]
        public class CustomEntityDefinition
        {

            [JsonProperty("resolvingParameters")]
            public ResolvingParameters[] Parameters { get; set; }

        }

        [JsonObject("category")]
        public class Category
        {

            [JsonProperty("resolvingParameters")]
            public ResolvingParameters[] Parameters { get; set; }

        }


        [JsonObject("csg")]
        public class CSG
        {

            [JsonProperty("resolvingParameters")]
            public ResolvingParameters[] Parameters { get; set; }

        }


        [JsonObject("itemA")]
        public class ItemA
        {

            [JsonProperty("resolvingParameters")]
            public ResolvingParameters[] 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 ResolvingParameters[]
                    {
                        new ResolvingParameters()
                        {
                            ParameterName = "shortCode",
                            ParameterValue = "CSGNAME"
                        }
                    }
                },

                ImportProfile = new ImportProfile()
                {
                    Parameters = new ResolvingParameters[]
                    {
                        new ResolvingParameters()
                        {
                            ParameterName = "shortCode",
                            ParameterValue = "PROFILEEXAMPLE"
                        }
                    }
                },
                CustomEntityDefinition  = new CustomEntityDefinition()
                {
                    Parameters = new ResolvingParameters[]
                    {
                        new ResolvingParameters()
                        {
                            ParameterName = "shortCode",
                            ParameterValue = "CUSTOMENTITYNAME"
                        }
                    }
                },
                Category  = new Category()
                {
                    Parameters = new ResolvingParameters[]
                    {
                        new ResolvingParameters()
                        {
                            ParameterName = "shortCode",
                            ParameterValue = "CATEGORYNAME"
                        }
                    }
                },
                ItemA = new ItemA()
                {
                    Parameters = new ResolvingParameters[]
                    {
                        new ResolvingParameters()
                        {
                            ParameterName = "shortCode",
                            ParameterValue = "ITEMANAME"
                        }
                    }
                },
                CustomFields = new CustomField[]
                {

                    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;
}


}


}

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings