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:

1custom.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+11
  • Hero (Employee)
  • 90 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:
 

1{
2 "eventTypeEnum": "INCIDENT",
3 "importProfile": {
4 "resolvingParameters": [
5 {
6 "parameterName": "shortCode",
7 "parameterValue": "PROFILEEXAMPLE"
8 }
9 ]
10 },
11 "affectedUserName": "Jonh",
12 "affectedUserTelephone": "+55 27 1234-5678",
13 "categoryId": 123,
14 "itemAId": 12345,
15 "remarks": "Lorem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum.",
16 "csgId": 1,
17 "entityDefinitionId": 12,
18 "customFields": [
19 {
20 "stringValue": "Rua X",
21 "customFieldShortCode": "ADDRESS",
22 "customFieldId": 999,
23 "customFieldType": 1
24 },
25 {
26 "stringValue": "Serra",
27 "customFieldShortCode": "CITY",
28 "customFieldId": 888,
29 "customFieldType": 1
30 }
31 ]
32}

 

C# Example:

 

1
2
3 public class IncidentExample: IAssystGenerico, IAlteravelEJB
4 {
5
6 [JsonProperty("eventTypeEnum")]
7 public string EventTypeEnum { get; set; }
8
9 [JsonProperty("importProfile")]
10 public ImportProfile ImportProfile { get; set; }
11
12 [JsonProperty("affectedUserName")]
13 public string AffectedUserName { get; set; }
14
15 [JsonProperty("affectedUserTelephone")]
16 public string AffectedUserTelephone { get; set; }
17
18 [JsonProperty("affectedUserEmail")]
19 public string AffectedUserEmail { get; set; }
20
21 [JsonProperty("category")]
22 public Category Category { get; set; }
23
24 [JsonProperty("itemA")]
25 public ItemA ItemA { get; set; }
26
27 [JsonProperty("remarks")]
28 public string Remarks { get; set; }
29
30 [JsonProperty("shortDescription")]
31 public string ShortDescription { get; set; }
32
33 [JsonProperty("callbackRemark")]
34 public string CallbackRemark { get; set; }
35
36
37 [JsonProperty("csg")]
38 public CSG CSG { get; set; }
39
40
41 [JsonProperty("customEntityDefinition")]
42 public CustomEntityDefinition CustomEntityDefinition { get; set; }
43
44
45 [JsonProperty("customFields")]
46 public CustomField[] CustomFields { get; set; }
47
48
49 }
50
51
52 [JsonObject("resolvingParameters")]
53 public class ResolvingParameters
54 {
55
56 [JsonProperty("parameterName")]
57 public string ParameterName { get; set; }
58
59 [JsonProperty("parameterValue")]
60 public string ParameterValue { get; set; }
61
62 }
63
64 [JsonObject("importProfile")]
65 public class ImportProfile
66 {
67
68 [JsonProperty("resolvingParameters")]
69 public ResolvingParameters[] Parameters { get; set; }
70
71 }
72
73 [JsonObject("customEntityDefinition")]
74 public class CustomEntityDefinition
75 {
76
77 [JsonProperty("resolvingParameters")]
78 public ResolvingParameters[] Parameters { get; set; }
79
80 }
81
82 [JsonObject("category")]
83 public class Category
84 {
85
86 [JsonProperty("resolvingParameters")]
87 public ResolvingParameters[] Parameters { get; set; }
88
89 }
90
91
92 [JsonObject("csg")]
93 public class CSG
94 {
95
96 [JsonProperty("resolvingParameters")]
97 public ResolvingParameters[] Parameters { get; set; }
98
99 }
100
101
102 [JsonObject("itemA")]
103 public class ItemA
104 {
105
106 [JsonProperty("resolvingParameters")]
107 public ResolvingParameters[] Parameters { get; set; }
108
109 }
110
111
112 [JsonObject("customFields")]
113 public class CustomField
114 {
115
116
117
118 [JsonProperty("stringValue")]
119 public string StringValue { get; set; }
120
121
122 [JsonProperty("customFieldShortCode")]
123 public string CustomFieldShortCode { get; set; }
124
125
126 [JsonProperty("customFieldId")]
127 public int CustomFieldId { get; set; }
128
129 [JsonProperty("customFieldType")]
130 public int CustomFieldType { get; set; }
131
132
133 }
134
135
136
137
138public void RegisterEventInAssyst(){
139
140 IncidentExample eventObj = new IncidentExample()
141 {
142
143 EventTypeEnum = "INCIDENT",
144 AffectedUserName = "Jonh",
145 AffectedUserTelephone = "+55 27 1234-5678",
146 AffectedUserEmail = "test@test.com",
147 Remarks = "Lorem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum solo diem ipsum.",
148 ShortDescription = "Excerpt",
149 CallbackRemark = "test@test.com",
150 CSG = new CSG()
151 {
152 Parameters = new ResolvingParameters[]
153 {
154 new ResolvingParameters()
155 {
156 ParameterName = "shortCode",
157 ParameterValue = "CSGNAME"
158 }
159 }
160 },
161
162 ImportProfile = new ImportProfile()
163 {
164 Parameters = new ResolvingParameters[]
165 {
166 new ResolvingParameters()
167 {
168 ParameterName = "shortCode",
169 ParameterValue = "PROFILEEXAMPLE"
170 }
171 }
172 },
173 CustomEntityDefinition = new CustomEntityDefinition()
174 {
175 Parameters = new ResolvingParameters[]
176 {
177 new ResolvingParameters()
178 {
179 ParameterName = "shortCode",
180 ParameterValue = "CUSTOMENTITYNAME"
181 }
182 }
183 },
184 Category = new Category()
185 {
186 Parameters = new ResolvingParameters[]
187 {
188 new ResolvingParameters()
189 {
190 ParameterName = "shortCode",
191 ParameterValue = "CATEGORYNAME"
192 }
193 }
194 },
195 ItemA = new ItemA()
196 {
197 Parameters = new ResolvingParameters[]
198 {
199 new ResolvingParameters()
200 {
201 ParameterName = "shortCode",
202 ParameterValue = "ITEMANAME"
203 }
204 }
205 },
206 CustomFields = new CustomField[]
207 {
208
209 new CustomField()
210 {
211 StringValue = "Rua X",
212 CustomFieldShortCode = "ADDRESSNAME",
213 CustomFieldId = 999,
214 CustomFieldType = 1
215 }
216
217 }
218 };
219
220
221using (var client = new HttpClient()){
222
223 string urlRelativa = "/assystREST/v2/events";
224 client.BaseAddress = "https://url-base";
225
226 client.DefaultRequestHeaders.Add("X-CSRF-Header", String.Empty);
227 client.DefaultRequestHeaders.Add("Accept", "application/json");
228 string entidade1 = Newtonsoft.Json.JsonConvert.SerializeObject(eventObj);
229StringContent entidade2 = new StringContent(entidade1, System.Text.Encoding.UTF8, "application/json");
230
231
232HttpResponseMessage response = client.PostAsync(urlRelativa, entidade2).Result;
233
234if (response.IsSuccessStatusCode){
235 var stringResponse = response.Content.ReadAsStringAsync().Result;
236}
237
238
239}
240
241
242}
243
244

 


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