Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when retrieving History Actions #10

Open
scottwhitacre opened this issue Nov 15, 2024 · 0 comments
Open

Exception when retrieving History Actions #10

scottwhitacre opened this issue Nov 15, 2024 · 0 comments

Comments

@scottwhitacre
Copy link

I have been able to retrieve some actions when the only actions returned are paths read or updated. But I am getting exception when the action has a target. The library seems to be able to retrieve data from the endpoint, but the exception seems to happen when attempting to map the Action class to the data.

Here is my code that works sometimes:

var since = DateTime.Now.AddHours(-12);
var config = new FilesCom.FilesConfiguration()
{
    BaseUrl = filesDotComApiSettings.Url,
    ApiKey = filesDotComApiSettings.ApiKey
};

_=new FilesCom.FilesClient(config);

var paramters = new Dictionary<string, object>
{
    { "start_at", since.ToUniversalTime().ToString("u") }
};

var actions = Folders
    .SelectMany(f =>
        History.ListForFolder(f, paramters).ListAutoPaging()
        .ToList())
    .ToList();

I have had the same issue when using History.List(parameters)

System.AggregateException: One or more errors occurred. (Unexpected data received from uri:

Here is an example of a successful action retrieval where he data in tags is our data:

[
  {
          "id": 16565950247,
          "path": "<path>",
          "when": "2024-11-14T14:57:04-05:00",
          "destination": <path>",
          "ip": "<ip>",
          "user_id": null,
          "username": null,
          "user_is_from_parent_site": null,
          "action": "update",
          "interface": "restapi"
      }
]

Here is an example of an UNsuccessful example:

[
   {
        "id": 16565514079,
        "when": "2024-11-14T14:24:29-05:00",
        "ip": "<ip>",
        "targets": {
            "user": {
                "id": <ip>,
                "username": "<username>"
            }
        },
        "user_id": <userId>,
        "username": "<username>",
        "user_is_from_parent_site": true,
        "action": "user_update",
        "interface": "web"
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant