API: Move Folder not working

27370

Hi,

according to 
https://collaborate.highq.com/sitepoint/wikiHome.action?metaData.siteID=714&metaData.wikiID=7557

the call goes as follows:
 

PUT  /folders/{folderid}/parent?targetfolder=<targetfolderid>

Interestingly "move" and "copy" are the only API-Calls that miss the "api/1" in their path. And they have angle brackets, that's different to all other calls too.

The URL above misses an example.

So I tried in PHP 7:
 

$ch = curl_init();curl_setopt($ch, CURLOPT_URL,"">mycompany.highq.com/.../parent, CURLOPT_PROXY, "456");curl_setopt($ch, CURLOPT_HTTPHEADER, array(    'Auth-Type:OAUTH2',    'Authorization:Bearer '.HIGHQ_ACCESSTOKEN));curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$answer = curl_exec($ch);curl_close ($ch);

As you can see, I dropped the angle brackets. The answer I get:

Unsupported Request

PUT to mycompany.highq.com/.../parent not supported.

Reference #8.24b51002.1572269111.bea7bcd

All my other attempts with "api/6" or similar ended in "Bad Request - Your browser sent a request that this server could not understand." The angular brackets did't work either.

Please help.

 

 

  • Helmut Rinda can you please confirm that you are not trying to move documents between sites as that feature is not available in Collaborate UI hence not supported in the API, if you move files within a site then it should work.

  • Imran Aziz , I do not move documents between two sites. I do not understand the second part of your question. I can move the folder to the new destination in Callobarota UI without a problem. Is it possible to turn "move folder" off for a user?

  • Andrew Quinn, your proposal triggers this answer:
    Bad Request
    Your browser sent a request that this server could not understand.

    This was one of the first variants I tested.

    "Folder rename" and "add folder" are no problem.

  • Helmut Rinda, Hi I can confirm that this is working for me. PUT {{hostname}}/api/{{apiversion}}/folders/642759/parent?targetfolder=600712

  • David Corrin thx for letting me know. Still not working for me. I hope the support will find a solution.

     

  • Helmut Rinda My only other suggestions are to confirm your authorisation when using swagger and double check ids (ensuring they are the correct way round as well). Hope you get sorted soon.

  • The support sent me the header-protocol of their request and so I found the missing part.

    It's "Content-Length:0".

     

    So the working PHP code is:

     

            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL,"https://mycompany.highq.com/mycompany/api/6/folders/889313/parent?targetfolder=137363");

            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                'Content-Length:0',
                'Authorization:Bearer '.HIGHQ_ACCESSTOKEN
            ));
            
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

            $answer = curl_exec($ch);

            curl_close ($ch);