Get Files Associated to Data Template via API

Get Files Associated to Data Template via API

I have a data template with multiple files associated to it, and trying to write a Deluge script that will fetch files associated with this data template.

I created the script below based on the WorkDrive API documentation, one request uses the data templates endpoint while the other uses the search endpoint. Both requests are returning empty responses, even though I know the data template has files associated.

What am I doing wrong here? Is there any way to find a specific file via API based on a value in a data template field?
  1. dataTemplate_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  2. header = Map();
  3. header.put("Accept","application/vnd.api+json");
  4. response = invokeurl
  5. [
  6. url :"https://www.zohoapis.com/workdrive/api/v1/datatemplates/" + dataTemplate_id + "/files"
  7. type :GET
  8. headers:header
  9. connection:"wdrive"
  10. ];
  11. info response;
  12. //
  13. //
  14. team_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  15. query = "test";
  16. params = "?search%5Ball%5D=" + query + "&filter%5Bdatatemplate%5D=" + dataTemplate_id;
  17. info params;
  18. response = invokeurl
  19. [
  20. url :"https://www.zohoapis.com/workdrive/api/v1/teams/" + team_id + "/records" + params
  21. type :GET
  22. headers:header
  23. connection:"wdrive"
  24. ];
  25. info response;