To pull list of all files in a folder of zoho workdrive using REST API

To pull list of all files in a folder of zoho workdrive using REST API

Hello Team,

I am trying to connect Zoho workdrive using REST API with powershell and List the files and folders to get the properties of the files especially the embed code of the video files.

I am able to get the refresh token and access token.
However when I try to run the invoke request for listing files of a folder it says 
Invoke-RestMethod : {"errors":[{"id":"F000","title":"INVALID_SCOPE"}]}

I tried WorkDrive.files.READ and WorkDrive.files.ALL both but its same error all the time.

Here is my script:


$tokenParams = @{
    client_id     = "1000.XXXXXXXXXXXXXXSL"
    client_secret = "bb8XXXXXXXX38e3a0eab"
    redirect_uri  = "https://www.google.com/callback"
    code          = "1000.6eXXXXXXXXXXXXXXXXX8d"
    grant_type    = "authorization_code"
}

$response = Invoke-RestMethod -Uri $tokenUrl -Method Post -Body $tokenParams

# Display the entire response to view all details
$response

$accessToken = $response.access_token
$refreshToken = $response.refresh_token
Write-Host "Access Token: $accessToken"
Write-Host "Refresh Token: $refreshToken"

$folderId = "ahtl1cf04bXXXXXXXX816e93cb9"

$headers = @{
    "Authorization" = $newAccessToken
}

$response = Invoke-RestMethod -Uri $url -Method Get -Headers $headers


    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方