I'm running SOAP advanced search through search_service_requests.js, and while the following output it sends looks good, it returns all asset types.
Also, the limit is ignored too, with dozens of results being returned.
Is there a problem with the following request?
var assets = ['page_standard','calendar_event_single'],
limit = 10,
format = '%asset_assetid%',
root = 12345,
statuses = [2,4,8,16,32,64,128,256],
searchParams = '...', // omitted from post as long and irrelevant
function multiple_elements_to_string(array_elements, element_name)
{
var result_str = '';
for (var i = 0; i < array_elements.length; i++) {
result_str += '<'+element_name+'>'+array_elements[i]+'</'+element_name+'>';
}//end for
return result_str;
}//end multiple_elements_to_string()
Have you tried using calling the soap call without JS? Just via a SOAP dev client or even within the Matrix interface to see if you can get that working first? Also, not sure if adding multiple statuses by multiple tags actually will search all those statuses, i thought you would just put all statuses into the 1 tag, but might be wrong, probably not your issue anyway.
Hey Bart, thanks. I'm not sure about the statuses, the API seems to be expecting an array, as it calls a method to split it, wrapping each value in <statuses>.
The same behaviour is applied to the asset_types variable. I'm not confident enough to say with any certainty, but I suspect that this is could be a bug - unless I'm totally wrong and the API is not expecting a simple array.
Hey Bart, thanks. I'm not sure about the statuses, the API seems to be expecting an array, as it calls a method to split it, wrapping each value in <statuses>.
Yes, you are correct, for things like Statuses it is expecting it in the format:
Thanks Nic, my problem is that search_service_requests.js does not seem able to output the correct XML structure based on the array provided, so I must be wrong in feeding it a simple array, unless it's a bug.
var asset_types_str = multiple_elements_to_string(asset_types, "AssetTypes");
Thanks Nic, I can, but It'd be easier to run with the pre-built function libraries by Squiz - and that would be my preference, assuming they'd update the libraries in line with changes from version to version.
I wonder if the limit failure is also a bug at the SOAP server level, any theories?
I wonder if the limit failure is also a bug at the SOAP server level, any theories?
I have used the limit option in my app and it seemed to work exactly how it should. I would use a SOAP client to test the function if you are having doubts.