If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#51519 by UnionSystems
Wed Sep 04, 2019 10:45 pm
We have a REST service publishing JSON from AwareIM and being read by Javascript on the published AwareIM App to provide a nice autocomplete lookup. Only problem we have is when our query results in more than 1 result the returned JSON is embedded in a "response" array but when result count is 1 or 0 there is no response array.

URL request : http://localhost:8080/AwareIM/REST/nswtfUA/rest_v_Search?filter=louis
JSON result :
Code: Select all{
"response": [
{
"Icon": "user",
"Paid": "Yes",
"ObjectName": "Person",
"Name": "0008948 Louis Cobb",
"Line2": "Nsw Education Standards Authority - South Coast",
"ObjectID": 2072505,
"UnionPos": "hidden"}
,
{
"Icon": "user",
"Paid": "Yes",
"ObjectName": "Person",
"Name": "0003310 Louis Whitfield",
"Line2": "United Dental Hospital (TAFE Dental - Randwick College)",
"ObjectID": 2049953,
"UnionPos": "hidden"}
]
}



URL request : http://localhost:8080/AwareIM/REST/nswtfUA/rest_v_Search?filter=0008517.
JSON result :
Code: Select all{
"Icon": "user",
"Paid": "Yes",
"ObjectName": "Person",
"Name": "0008517 Louis David",
"Line2": "Ultimo Campus - Labour Market Progs",
"ObjectID": 2070781,
"UnionPos": "hidden"}


URL request : http://localhost:8080/AwareIM/REST/nswtfUA/rest_v_Search?filter=rubbish.
JSON result :

Challenge is the Javascript library we are using (Kendo UI) is expecting a JSON array not a single JSON element. We are trying to make the Javascript handle the different JSON results but it would be much easier if a response array was always returned even when it has ONE or ZERO results?

Who is online

Users browsing this forum: MSN [Bot] and 16 guests