Searching for GuidanceItems content via JSON WebServices call

In the new version of TeamMentor, click on the TM WebServices link (top right)

This will open the admin gui which exposes a number of admin interfaces/tools, including of helper methods to directly invoke the webservices:

The GuidanceItem Search web service can be reached by clicking on the Libraries link (first one on the left)

Then select the guidanceItems_SearchHtml link

… click on the Invokebutton,

and the search results will show below in JSON format

The search text can either be a string or a regex (in the case below we’re searching using the regex OWASP.*XSS ) :

Here is the code that runs this search on the backend webservice This shows how easy it is to create Linq queries to filter and manipulate the TeamMentor (Xml-driven) database

        public static List<GuidanceItem_V3> guidanceItem_SearchHtml(this TM_Xml_Database tmDatabase, string searchText)
        {
            var maxNumberOfItemsToReturn = 100;
            var lowercaseSearchText = searchText.lower();
            return     (from guidanceItem in tmDatabase.GuidanceItems
                     where guidanceItem.htmlContent.lower().contains(lowercaseSearchText) ||
                           guidanceItem.htmlContent.regEx(searchText)
                     select guidanceItem
                    ).Take(maxNumberOfItemsToReturn)
                     .toList();
        }       
Advertisements

About Dinis Cruz

Dinis Cruz is the main developer of the OWASP O2 Platform and TeamMentor
This entry was posted in WebServices. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s