Can SOAP or JS API return asset details from search?


(Charlotte Westney) #1

Hi everyone,


<Knowlege Disclaimer>

I am about to ask a question on a topic I know nothing about. To me, Soap lives by the bathroom sink, I've never used it for a website. But I need to know in principle if something can be done, and I'm betting you guys know the answer… </Knowlege Disclaimer>



Background:

We are going to store a bunch of data in Matrix, that will get called in to a smartphone App. When a user updates their App, they need to connect to Matrix, and get all the details of all the assets that have been changed since they last updated. So each update will be a search, with the user sending an individual timestamp to search against.





Q1: Can the SOAP API or the JS API return details of assets based on a search?



I need a way to return the full details of all the assets in a set root node, but only if those assets have an Updated Date that is more recent than when the user last did a search. So, a search for all assets where asset Updated Date > users timestamp date, that returns the full details of all assets in the results list.





Q2: Can the SOAP API / JS API return details of shadow assets or do they need to be full assets?

All the data is currently in csv files, so the easiest way will be to import the csv files and create shadow assets. But, can the SOAP / JS API call details from shadow assets, and can it search against shadow assets (if the answer to Q1 is yes) or will I need to create these all as real assets?





Q3: Is there a totally different and better way to achieve what I'm trying to do?!





Thanks everyone!

Charlie.


(Nic Hubbard) #2

I almost think that you are going to have to do some sort of filtering by date on your mobile device rather than trying to do it on Matrix. Are you using iOS?


As for being able to search for Shadow Assets. No, this won't work because they are not indexed, therefor you can't find them in search.


(Anton Babushkin) #3

Hi Charlie,


SOAP / JS API is one of the ways that you can hook into Matrix data, but it certainly isn't the only way.


[quote]Q1: Can the SOAP API or the JS API return details of assets based on a search?[/quote]



Yes, you can use the Search service of the SOAP server to do what you're after. You'll need to pass through Advanced Search parameters (reference - http://manuals.matrix.squizsuite.net/web-services/appendices/appendix-soap-complextype-parameters)


[quote]Q2: Can the SOAP API / JS API return details of shadow assets or do they need to be full assets?[/quote]



As Nic mentioned, shadow assets are not indexed therefore utilising standard Matrix search (including SOAP search) is not an option. However, you can create a "pseudo" search page by utilising the REST Resource asset + an Asset Listing. It would have the following workflow: [[ Your app ]] --> [[ Matrix ]] < – > [[ REST Resource JavaScript ]] --> Asset Listing --> CSV Data Source



This isn't really the best way of doing it, but can get you across the line if you're after a quick and dirty implementation.



Otherwise you'll need to migrate the CSV records into Matrix as standalone assets.


[quote]Q3: Is there a totally different and better way to achieve what I'm trying to do?![/quote]



Yes and no. Just depends on your team and what your preferred option is. I would use SOAP / REST API (JS API) as much as possible though :slight_smile:



Hope that helps.


(Charlotte Westney) #4

Thanks for all your help chaps.


So, I think I've concluded that:



1 - I'll need the assests imported as proper assets, not shadow assets, with metadata to capture all the details.

2 - I should be able to use the SOAP service to do the search, using Advanced Search parameters.



Without going into the exact code detail of how that SOAP search would work, I can see there is a SearchField parameter, to pass the search term, and that the DataSource could then be a MetadataOption, and the MetadataOption is the metdata field ID.



Will the SOAP search allow us to set a condition in the search, so it will work like this [psuedo code coming up…]

    
    search all assets in root node 1234
    where 'asset MetadataDate' <= the searchterm 'PhoneDate'


That way, Matrix will then return a list of just the results that that user needs, rather than users always getting all the results and having to search them on the phone, which would be a bigger download and therefore take more time.

Thanks again!
Charlie.

(Anton Babushkin) #5

Whilst you can do search using the SOAP service, I’m not 100% sure if you can do it based on the “smaller or equals” (<=) condition.


A search page asset does allow you to specify the “oldest date” and the “newest date” parameters, so you might be able to fudge that somehow, but I haven’t actually tried doing that programatically via SOAP.



P.S. The matrixusers.com site has a timeline to the left, and I’m using the REST Resource JavaScript + Asset Listing technique to do the exact thing you’re trying and it’s working well.


(Pawel Masloch) #6

Hi,

Have you tried using a ‘Record filter’ on a data source? There are a number of rules you can set there - it may come in handy…