Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2013-08-20 15:41:00

terryi
Member
Registered: 2013-08-01
Posts: 3

Creating Smart Folders through the API

Hi again

I'm interested in creating Smart Folders via the API (probably using a systematic approach as we need a lot of Smart Folders). I had a look in the API docs and found that the Folders_CreateFolder() method can create Smart Folders if I send a hash of searchParams().

I was wondering if Search_AdvancedSearch() is basically the same in terms of its arguments as the searchParams() hash? I couldn't find a reference in the docs to searchParams().

Thanks
Terry

Offline

#2 2013-08-30 17:20:53

thirdlight
Third Light Staff
Registered: 2013-06-06
Posts: 23

Re: Creating Smart Folders through the API

Hi Terry,

I asked this question for you today when I had a chance, and the answer is that the API call for the Smart Folder is actually not the same as the advanced search fields. Sorry about this - it's one of those things where it doesn't fit well with older code. However, in better news, we are going to be working on this very shortly (in the next month to two months) and releasing some other neat tools to do with Smart Folders that you might like. I'll post a follow up when I have more news for you.

Best wishes
Michael

Offline

#3 2013-10-04 14:40:04

ohilton
Member
Registered: 2013-10-04
Posts: 12

Re: Creating Smart Folders through the API

Did anything come of this?  I'm trying to create smart folders via API also and nothing around the 'searchParams' value is documented that I can find, what is the format for these?

Offline

#4 2013-10-04 17:21:26

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: Creating Smart Folders through the API

Hi Oliver,

From v6.0.16, the Folders.CreateFolder (and similar) methods accept search parameters in the same format as Search.AdvancedSearch. In addition, some problems with the existing Search.AdvancedSearch method are corrected.

Dominic

Offline

#5 2013-10-07 11:01:48

ohilton
Member
Registered: 2013-10-04
Posts: 12

Re: Creating Smart Folders through the API

Thanks Dominic, I'm a step closer now with a fair amount of trial and error I've managed to get folders being created using the CreateFolder and CreateFolderPath methods however while I can pass a searchParams value that doesn't make the method fail I can't get a smart folder created that actually stores and uses the passed search params.  For example here is an inParams call:

"inParams":{"folderPath":"/path/tofolder", "type":"smartFolder", "searchParams":[{"fieldId":143, "conditionId":0, "value":"SearchValue"}]}

As a side note if you pass 'SMART_FOLDER' instead of 'smartFolder' I get an 'ACTION_NOT_PERMITTED' result.  I've tried passing the searchParams as both a straight hash as well as an array with one hash in it, both result in no search conditions being saved in the folder setup, going in to edit you see 'No search conditions are currently configured'.  I've obviously taken those fieldid and conditionid values from the arrays returned from the Search.GetSearchConfiguration call and I've also tried passing them quoted, no luck with any of it.  Help!!

Oli

Offline

#6 2013-10-07 11:24:01

ohilton
Member
Registered: 2013-10-04
Posts: 12

Re: Creating Smart Folders through the API

Oh and our version is currently at 6.0.14-19 with no option to upgrade further? Not sure if this means we're at or past 6.0.16 or not!

Offline

#7 2013-10-07 12:08:16

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: Creating Smart Folders through the API

6.0.16 builds will have version numbers looking like 6.0.16-x: this has not been released yet. However, if you enable the "Show pre-release updates" option for your site, you should be able to upgrade to the release candidate of 6.0.15-9, which I believe also contains the necessary change.

Offline

#8 2013-10-07 12:19:27

steve
Third Light Staff
Registered: 2013-06-06
Posts: 105

Re: Creating Smart Folders through the API

Hi Oli,

Just to expand on Dominic's reply, the procedure for enabling pre-releases is as follows:

Configuration > Site Options > Other Settings > Show pre-release IMS updates
then
Configuration > Software updates > Check for Updates/Update

Offline

#9 2013-10-08 16:58:30

ohilton
Member
Registered: 2013-10-04
Posts: 12

Re: Creating Smart Folders through the API

Thanks for that, just to confirm now we're up to date with the very latest version of IMS the searchParam format above is now working and creating folders as expected.  There's potentially an issue where the folders don't get populated with their relevant results when made this way but I've put in a new support ticket for that as I'm not sure it's an API problem!

Offline

#10 2013-10-09 13:41:42

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 119

Re: Creating Smart Folders through the API

Hi Oli,

I've been testing this against the latest RC (6.0.15-12), and I can see the results straight away (calls to Folders.CreateFolder then Files.GetAssetsForParent). This update adds support for SMART_FOLDER as an alias of SMARTFOLDER, and corrects an issue with search condition CONTAINS (ID = 0). Could you update to this and try again? If you're still having trouble, could you give some details of the parameters that you are setting - in case it is specific to a field type or condition.

Dominic

Offline

Board footer