Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [che-dev] a question regarding api: GET /project/{ws-id}/tree/{parent:.*}

Thanks Gennady,

Any updates?

We'll be very happy if it could be included in the coming release.

 

Thanks,

Anat

 

From: che-dev-bounces@xxxxxxxxxxx [mailto:che-dev-bounces@xxxxxxxxxxx] On Behalf Of Gennady Azarenkov
Sent: Monday, June 01, 2015 1:49 PM
To: che developer discussions
Subject: Re: [che-dev] a question regarding api: GET /project/{ws-id}/tree/{parent:.*}

 

Hi,

 

I do not mind conceptually. 

People, any objections? 

 

If no, I'd let Vitaliy review your PR and apply when possible.

 

Best,


Gennady Azarenkov - CTO @ codenvy.com

 

 

On Mon, Jun 1, 2015 at 1:01 PM, Zil-Bar, Anat <anat.zil-bar@xxxxxxx> wrote:

Hi Gennady,

 

We try to minimize roundtrips between client and server as much as possible, therefore we would not like to traverse the tree using the getChildren() api as you suggested.

 

So, in order for us to have the functionality we need, I would like to suggest a small addition to the getTree() api (GET /project/{ws-id}/tree/{parent:.*})

 

I would like to add another query param: ?includeFiles (which will be set to false by default); this param will indicate whether or not to include file children in the result tree.

 

I've made the relevant changes and also added relevant tests.

 

Finally, I've created a pull request with my changes:

https://github.com/codenvy/che-core/pull/90

 

Could you please review/comment?

 

Thanks in advance,

Anat

 

 

 

 

From: che-dev-bounces@xxxxxxxxxxx [mailto:che-dev-bounces@xxxxxxxxxxx] On Behalf Of Gennady Azarenkov
Sent: Sunday, May 17, 2015 1:14 PM
To: che developer discussions
Cc: Sharav, Omer; Barlev, Eyal
Subject: Re: [che-dev] a question regarding api: GET /project/{ws-id}/tree/{parent:.*}

 

Hi Anat,

 

Yes, indeed, the purpose of getTree method is to return the structural elements (i.e. folders) only.

We did that consciously (it is the result of API evolution in fact) to not to load the server and channel with unpredictable huge amount of data at once.

 

If your task is to traverse the project structure I would recommend combining this method with getChildren() (GET "/children/{parent:.*}) which returns all the children (i.e. first level depth) of particular folder. This methodology works quite well for our several clients.

If you have something more specific in mind please elaborate.

 

HTH


Gennady Azarenkov - CTO @ codenvy.com

 

 

On Sun, May 17, 2015 at 12:41 PM, Zil-Bar, Anat <anat.zil-bar@xxxxxxx> wrote:

Hello,

 

I have a question regarding the api:

 

GET /project/{ws-id}/tree/{parent:.*}

 

When I call the above api on some folder, I've noticed that only the folders hierarchy is returned in the response, however all files are missing from the response.

 

e.g. if I have the following tree structure:

 

define(function(){

  
return {
     
"name" : "testDataRoot",
     
"type" : "folder",
     
"content" : [

      {
        
"name" : "folder00_00",
        
"type" : "folder",
        
"content" : [

         {
           
"name" : "folder00_00_00",
           
"type" : "folder",
           
"content" : [ {
              
"name" : "file00_00_00_00",
              
"type" : "file",
              
"content" : "Sample Content1"
           
}, {
              
"name" : "file00_00_00_01",
              
"type" : "file",
              
"content" : "Sample Content2"
           
}, {
              
"name" : "file00_00_00_02",
              
"type" : "file",
              
"content" : "Sample Content3"
           
}, {
              
"name" : "file00_00_00_03",
              
"type" : "file",
              
"content" : "Sample Content4"
           
} ]
         },

         {
           
"name" : "folder00_00_01",
           
"type" : "folder",
           
"content" : []
         },

         {
           
"name" : "folder00_00_02",
           
"type" : "folder",
           
"content" : []
         }

         ]
      },

      {
        
"name" : "folder00_01",
        
"type" : "folder",
        
"content" : [

         {
           
"name" : "folder00_01_00",
           
"type" : "folder",
           
"content" : [ {
              
"name" : "file00_00_01_00_01.html",
              
"type" : "file",
              
"content" : "Sample Content5"
           
}, {
               
"name" : "file00_00_01_00_02",
              
"type" : "file",
              
"content" : "Sample Content6"
           
} ]
         },

         {
           
"name" : "folder00_01_01",
           
"type" : "folder",
           
"content" : []
         }

         ]
      }

      ]

   };

});

 

 

and I send the following request:

 

localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot?depth=1000

 

 

I get the below response (as you can see only folder items are returned but all files are missing).

 

Is it the expected behavior? If so, how can I get a folder's full tree hierarchy of sub-folders and files?

If there is no such api, can we consider an extension to the /tree api as a contribution perhaps?

 

Thanks in advance,

Anat

 

 

Response:

 

{

    "node": {

        "name": "testDataRoot",

        "type": "folder",

        "path": "/TestProject_1431527934597_12/testDataRoot",

        "attributes": {},

        "contentLength": 0,

        "modified": 1431527940583,

        "created": -1,

        "mediaType": "text/directory",

        "links": [

            {

                "method": "GET",

                "parameters": [],

                "produces": "application/zip",

                "rel": "zipball sources",

                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot"

            },

            {

                "method": "GET",

                "parameters": [],

                "produces": "application/json",

                "rel": "children",

                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot"

            },

            {

                "method": "GET",

                "parameters": [],

                "produces": "application/json",

                "rel": "tree",

                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot"

            },

            {

                "method": "GET",

               "parameters": [],

                "produces": "application/json",

                "rel": "modules",

                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot"

            },

            {

                "method": "DELETE",

                "parameters": [],

                "rel": "delete",

                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot"

            }

        ]

    },

    "children": [

        {

            "node": {

                "name": "folder00_00",

                "type": "folder",

                "path": "/TestProject_1431527934597_12/testDataRoot/folder00_00",

                "attributes": {},

                "contentLength": 0,

                "modified": 1431527940628,

                "created": -1,

                "mediaType": "text/directory",

                "links": [

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/zip",

                        "rel": "zipball sources",

                        "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/json",

                        "rel": "children",

                        "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                       "produces": "application/json",

                        "rel": "tree",

                        "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/json",

                        "rel": "modules",

                        "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00"

                    },

                    {

                        "method": "DELETE",

                        "parameters": [],

                        "rel": "delete",

                        "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00"

                    }

                ]

            },

            "children": [

                {

                    "node": {

                        "name": "folder00_00_00",

                        "type": "folder",

                        "path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00",

                        "attributes": {},

                        "contentLength": 0,

                        "modified": 1431527940670,

                        "created": -1,

                        "mediaType": "text/directory",

                        "links": [

                            {

                                "method": "GET",

                               "parameters": [],

                                "produces": "application/zip",

                                "rel": "zipball sources",

                                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "children",

                                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "tree",

                                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"

                           },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "modules",

                                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"

                            },

                            {

                                "method": "DELETE",

                                "parameters": [],

                                "rel": "delete",

                                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_00"

                            }

                        ]

                    },

                    "children": []

                },

                {

                    "node": {

                        "name": "folder00_00_01",

                        "type": "folder",

                        "path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01",

                        "attributes": {},

                        "contentLength": 0,

                        "modified": 1431527940627,

                        "created": -1,

                        "mediaType": "text/directory",

                        "links": [

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/zip",

                                "rel": "zipball sources",

                                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "children",

                                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "tree",

                                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "modules",

                                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"

                           },

                            {

                                "method": "DELETE",

                                "parameters": [],

                                "rel": "delete",

                                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_01"

                            }

                        ]

                    },

                    "children": []

                },

                {

                   "node": {

                        "name": "folder00_00_02",

                        "type": "folder",

                        "path": "/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02",

                        "attributes": {},

                        "contentLength": 0,

                        "modified": 1431527940623,

                        "created": -1,

                        "mediaType": "text/directory",

                        "links": [

                           {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/zip",

                                "rel": "zipball sources",

                                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "children",

                                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "tree",

                                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "modules",

                                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"

                            },

                            {

                                "method": "DELETE",

                                "parameters": [],

                                "rel": "delete",

                                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_00/folder00_00_02"

                            }

                        ]

                    },

                    "children": []

                }

            ]

        },

        {

            "node": {

                "name": "folder00_01",

                "type": "folder",

                "path": "/TestProject_1431527934597_12/testDataRoot/folder00_01",

                "attributes": {},

                "contentLength": 0,

                "modified": 1431527940605,

                "created": -1,

                "mediaType": "text/directory",

                "links": [

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/zip",

                        "rel": "zipball sources",

                        "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/json",

                        "rel": "children",

                        "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/json",

                        "rel": "tree",

                        "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01"

                    },

                    {

                        "method": "GET",

                        "parameters": [],

                        "produces": "application/json",

                        "rel": "modules",

                        "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01"

                    },

                    {

                        "method": "DELETE",

                        "parameters": [],

                        "rel": "delete",

                        "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01"

                    }

                ]

            },

            "children": [

                {

                    "node": {

                        "name": "folder00_01_00",

                        "type": "folder",

                        "path": "/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00",

                        "attributes": {},

                        "contentLength": 0,

                        "modified": 1431527940650,

                        "created": -1,

                        "mediaType": "text/directory",

                        "links": [

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/zip",

                                "rel": "zipball sources",

                                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "children",

                                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "tree",

                                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "modules",

                                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"

                            },

                            {

                                "method": "DELETE",

                                "parameters": [],

                                "rel": "delete",

                                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_00"

                            }

                        ]

                    },

                    "children": []

                },

                {

                    "node": {

                        "name": "folder00_01_01",

                        "type": "folder",

                        "path": "/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01",

                        "attributes": {},

                        "contentLength": 0,

                        "modified": 1431527940605,

                        "created": -1,

                        "mediaType": "text/directory",

                        "links": [

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/zip",

                                "rel": "zipball sources",

                                "href": "http://localhost:9090/api/project/1q2w3e/export/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "children",

                                "href": "http://localhost:9090/api/project/1q2w3e/children/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "tree",

                                "href": "http://localhost:9090/api/project/1q2w3e/tree/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"

                            },

                            {

                                "method": "GET",

                                "parameters": [],

                                "produces": "application/json",

                                "rel": "modules",

                                "href": "http://localhost:9090/api/project/1q2w3e/modules/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"

                            },

                            {

                                "method": "DELETE",

                                "parameters": [],

                                "rel": "delete",

                                "href": "http://localhost:9090/api/project/1q2w3e/TestProject_1431527934597_12/testDataRoot/folder00_01/folder00_01_01"

                            }

                        ]

                    },

                    "children": []

                }

            ]

        }

    ]

}

 

 

 


_______________________________________________
che-dev mailing list
che-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/che-dev

 


_______________________________________________
che-dev mailing list
che-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/che-dev

 


Back to the top