Reputation: 1773
I'm using this request code from C# and getting a Bad Request result:
public class GoogleDriveManager
{
private static readonly HttpClient Client = new HttpClient();
private const string Access = "ACCESS";
public GoogleDriveManager()
{
Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Access);
}
public async Task<HttpResponseMessage> GetFilesAsync(string driveId)
{
var url =
$"https://www.googleapis.com/drive/v3/files?driveId={driveId}&includeItemsFromAllDrives=true&corpora=true&supportsAllDrives=true";
var result = await Client.GetAsync(url);
return result;
}
}
But when I make the same sort of request from Postman, it works great:
(Authorization Bearer Token, with token value the same as the one used above)
What am I doing wrong on the C# side?
Upvotes: 1
Views: 90
Reputation: 77
According to API documentation supported values for corpora are:
Your Postman example has corpora=drive but your C# example shows corpora=true.
Upvotes: 2