REST Service Response Issue

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
UnionSystems
Posts: 197
Joined: Fri Jun 17, 2016 7:10 am
Location: Brisbane Australia
Contact:

REST Service Response Issue

Post by UnionSystems »

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/nswt ... lter=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/nswt ... er=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/nswt ... er=rubbish.
JSON result :

Code: Select all


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?
AWS Linux, Windows Server, AIM 8.4 & 8.6
Post Reply