photools.com Community

IMatch Discussion Boards => IMatch Scripting and Apps => Topic started by: peterverm on October 25, 2024, 08:47:46 AM

Title: IMWS endpoint v1/folders/create
Post by: peterverm on October 25, 2024, 08:47:46 AM
Mario,

regarding the IMWS endpoint v1/folders/create

with Parameters
  parentid/parentidlist/parentpath Specifies the parent folder for the new folder(s). Use either parentid, parentidlist or parentpath. Optional
  foldername The name of the new new folder.

A small question.

Parameter "parentid/parentidlist/parentpath" is marked "Optional". 

But when i give only a "foldername" (fully qualified, like "E:\Users\Peter\Pictures\202x\4\12\10") and no "parent", see code below,

                    IMWS.post('v1/folders/create',{
                        foldername : FilePath
                    }).then(function(response) {

i get an error "error":

{   "code": 1102,
  "message": "Invalid parameter.",
  "details": {
      "parameter": "parent",
      "description": "No parent folder specified or parent folder invalid." } } },
"status": 400,
"statusText": "Bad Request" }

So "parent" is mandatory after all ?

Thanks,

Peter
Title: Re: IMWS endpoint v1/folders/create
Post by: Mario on October 25, 2024, 09:03:31 AM
QuoteParameter "parentid/parentidlist/parentpath" is marked "Optional". 
Yes. And No. The Use either parentid, parentidlist or parentpath is important. IMWS needs to know what the parent folder for the new folder you want to create is. You must specify one of the 3 alternatives: id, path, idlist.
Title: Re: IMWS endpoint v1/folders/create
Post by: peterverm on October 28, 2024, 06:56:21 PM
OK.

It is a pity that it doesn't work like IMatch.folderCreate, there you can give the full path.  Easy.

IMatch.folderCreate({
path: FilePath

But thanks for your reply,  I enjoy IMatch very very much.

Regards,

Peter
Title: Re: IMWS endpoint v1/folders/create
Post by: Mario on October 28, 2024, 07:17:37 PM
If you look at the source code of IMatch.folderCreate, it calls

v1/filesystem/folder/create

which is totally different from the endpoint you are using.

To create a new folder under " E:\Users\Peter\Pictures\202x\4\12\10" (must be in your database) you specify it as the parentPath if you don't have the id. And the name of the folder to create under it.