I don't think this is the issues as my error returns 404 so it cannot find the url at all.
The url is build in a function defined in resources.js
getUserLog: function (type, since) {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"logApiBaseUrl",
"GetCurrentUserLog",
[{ logtype: type, sinceDate: since }])),
'Failed to retrieve user data for id ' + id);
}
It looks like it gets wrong the url to action it builds.
Yes, I think that is the bug, and what is resolved by the fix, essentially the logAPIBaseUrl GetCurrentUserLog isn't expecting the parameters to be passed in that way... eg as a single dictionary, the method above should be:
umbRequestHelper.getApiUrl(
"logApiBaseUrl",
"GetCurrentUserLog",
[{ logtype: type}, {sinceDate: since }])),
'Failed to retrieve log data for current user of type ' + type + ' since ' + since);
}
(so if you change that in your resource.js file all should be ok)
Two things are wrong:
1) The sinceDate and logType need to be passed as seperate values, not a single dictionary
2) if you look at the error message 'Failed to retrieve user data for id, it's writing out an + id variable that doesn't exist - the error message has been copied and pasted from a different endpoint!
Well, still it doesn't look as it suppose I think.
No matter what date I pass to the function it seems to be ignoring it and returns some items but for sure not all the items which have been edited by the user within even the time period it takes into account.
Eg.
I'm passing 10 Oct 2017 or 1 Nov 2017 and it returns some items (always same items no matter the date) since 26 Oct but not the all content/ media that have been edited.
So it looks like the since parameter is ignored whatsoever and the items array returned are based on something else.
(new Date(2017,9,11) in the example below gives Date 2017-10-10T23:00:00.000Z)
logResource.getUserLog("save", new Date(2017,9,11)).then(function (response) {
console.log(response);
var logEntries = [];
//alert('its here!');
// loop through the response, and filter out save log entries we are not interested in
angular.forEach(response, function (item) {
// // if no entity exists -1 is returned for the nodeId (eg saving a macro would create a log entry without a nodeid)
if (item.nodeId > 0) {
//this is the only way to tell them apart - whether the comment includes the words Content or Media!!
if (item.comment.match("(\\bContent\\b|\\bMedia\\b)")) {
if (item.comment.indexOf("Media") > -1) {
//log entry is a media item
item.entityType = "Media";
item.editUrl = "media/media/edit/" + item.nodeId;
}
if (item.comment.indexOf("Content") > -1) {
//log entry is a media item
item.entityType = "Document";
item.editUrl = "content/content/edit/" + item.nodeId;
}
//use entityResource to retrieve details of the content/media item
entityResource.getById(item.nodeId, item.entityType).then(function (ent) {
console.log(ent);
item.Content = ent;
});
logEntries.push(item);
}
}
console.log(logEntries);
vm.LogEntries = logEntries;
});
});
Message":"No HTTP resource was found that matches the request URI 'http://eight.local/umbraco/backoffice/UmbracoApi/Log/GetLog?logtype=save&sinceDate=2019-07-19T18%3A19%3A06.095Z'.","MessageDetail":"No action was found on the controller 'Log' that matches the name 'GetLog'.
Umbraco angular logResource.getUserLog returns 404 error
I am trying to build a custom dashboard listing last edits made by a user.
I am following the tutorial https://our.umbraco.org/documentation/Tutorials/Creating-a-Custom-Dashboard/#i-know-what-you-did-last-tuesday
It uses
logResource
and itsgetUserLog
method.And also I can see the method
getUserLogs
described in the umbraco api reference: https://our.umbraco.org/apidocs/ui/#/api/umbraco.resources.logResourceHowever when I'm running this method I'm getting 404 error on
Am I missing any umbraco extension or so?
View:
Hi manila
Which version of Umbraco are you using?
As the logResource had a bug up until Umbraco 7.6.4 preventing multiple parameters being passed to the GetCurrentUserLog endpoint:
see http://issues.umbraco.org/issue/U4-9489
and that may be the problem you are encountering?
regards
Marc
Version 7.5.14
I don't think this is the issues as my error returns 404 so it cannot find the url at all.
The url is build in a function defined in resources.js
It looks like it gets wrong the url to action it builds.
Hi manila
Yes, I think that is the bug, and what is resolved by the fix, essentially the logAPIBaseUrl GetCurrentUserLog isn't expecting the parameters to be passed in that way... eg as a single dictionary, the method above should be:
(so if you change that in your resource.js file all should be ok)
Two things are wrong:
1) The sinceDate and logType need to be passed as seperate values, not a single dictionary
2) if you look at the error message 'Failed to retrieve user data for id, it's writing out an + id variable that doesn't exist - the error message has been copied and pasted from a different endpoint!
regards
Marc
You are right! Thanks
Well, still it doesn't look as it suppose I think.
No matter what date I pass to the function it seems to be ignoring it and returns some items but for sure not all the items which have been edited by the user within even the time period it takes into account.
Eg.
I'm passing 10 Oct 2017 or 1 Nov 2017 and it returns some items (always same items no matter the date) since 26 Oct but not the all content/ media that have been edited.
So it looks like the
since
parameter is ignored whatsoever and the items array returned are based on something else.(new Date(2017,9,11) in the example below gives
Date 2017-10-10T23:00:00.000Z
)Did you get this to work ?
i Umbraco 8, i'm getting this:
...
Thomas did you resolve the issue in version 8? I'm having the same headache.
Unfortunately not. And I am not working on this project any more so cannot see if there was any follow up or not.
In V8 there is the GetPagedCurrentUserLog method... but this only works as expected in 8.1.4 and above:
github.com/umbraco/Umbraco-CMS/issues/6000
is working on a reply...