IMWS endpoint v1/folders/create

Started by peterverm, October 25, 2024, 08:47:46 AM

Previous topic - Next topic

peterverm

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

Mario

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.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

peterverm

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

Mario

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.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook