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

Error response when getting the task list count. #444

Open
edfloreshz opened this issue Sep 26, 2023 · 2 comments
Open

Error response when getting the task list count. #444

edfloreshz opened this issue Sep 26, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@edfloreshz
Copy link

edfloreshz commented Sep 26, 2023

Describe the bug
The get_tasks_count method is returning this response.

{
   "error":{
      "code":"UnknownError",
      "innerError":{
         "client-request-id":"643b6c85-ddd3-4dcf-bd58-475528608f9c",
         "date":"2023-09-26T02:27:35",
         "request-id":"643b6c85-ddd3-4dcf-bd58-475528608f9c"
      },
      "message":""
   }
}

I think this may be an issue with Microsoft Graph or the API version you're calling, I think a request header has to be set, refer to this for more information:
https://devblogs.microsoft.com/microsoft365dev/build-advanced-queries-with-count-filter-search-and-orderby/

To Reproduce
Steps to reproduce the behavior:

  1. Call the method using the following API.
client.me().todo().list(task_list_id).tasks().get_tasks_count().send().await?;

Expected behavior
Return the count for the specified list.

Desktop (please complete the following information):

  • OS: Fedora 40
@edfloreshz edfloreshz added the bug Something isn't working label Sep 26, 2023
@edfloreshz edfloreshz changed the title BUG Error response when getting the task list count. Sep 26, 2023
@sreeise
Copy link
Owner

sreeise commented Sep 28, 2023

@edfloreshz Thanks for the report.

It does look like on these the ConsistencyLevel header is required. I'll have to dig into the open api metadata to see whether they are including that header as required so its implementation can be automated.

But for now, if you want to use that endpoint you can add the header yourself to the request by doing:

client.me().todo().list(task_list_id).tasks().get_tasks_count()
.header(HeaderName::from_str("ConsistencyLevel").unwrap(), HeaderValue::from_str("eventual").unwrap())
.send().await?;

Thanks

@edfloreshz
Copy link
Author

Neat! I'll try that today.

Thanks 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants