U4-8412 - Expose Media/GetDescendants in Umbraco API when using AJAX

Created by Shola 04 May 2016, 17:12:04 Updated by Shola 04 May 2016, 19:16:13

Your report will have a greater chance of being addressed if you can give us clear steps to reproduce the issue, please answer the following questions in as much detail as possible: What did you do? Hello everyone!

I'm trying to build a backoffice extension that needs to get all descendants of a given media node, and filter by a search term. I've noticed Umbraco is already doing something exactly like this in the Media section, when you use the Media search box, however it uses "GetChildren" not "GetDescendants." For example, this is the AJAX request URL when you search the Media section for "elephant":

/umbraco/backoffice/UmbracoApi/Media/GetChildren?id=-1&pageNumber=1&pageSize=10&orderBy=SortOrder&orderDirection=Ascending&filter=elephant

The above only searches the current folder (i.e. immediate children), and is not a deep search (i.e. all descendants). So, I've tried the below:

/umbraco/backoffice/UmbracoApi/Media/GetDescendants?id=-1&pageNumber=1&pageSize=10&orderBy=SortOrder&orderDirection=Ascending&filter=elephant

What did you expect to happen? I expected the GetDescendants request to return all descendants of the media item.

What actually happened? However, I get the following error in the backoffice:

Request error: The URL returned a 404 (not found): /umbraco/backoffice/UmbracoApi/Media/GetDescendants

The full AJAX response error is as follows:

{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:54503/umbraco/backoffice/UmbracoApi/Media/GetDescendants?id=-1&pageNumber=1&pageSize=10&orderBy=SortOrder&orderDirection=Ascending&filter=elephant'.","MessageDetail":"No action was found on the controller 'Media' that matches the name 'GetDescendants'."}

This seems strange, since GetDescendants is certainly a part of MediaService. Does Umbraco somehow not expose GetDescendants for AJAX requests, even though GetChildren is available?

Cheers!

Comments

Priority: Normal

Type: Bug

State: Closed

Assignee:

Difficulty: Normal

Category: Architecture

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.3

Due in version:

Sprint:

Story Points:

Cycle: