L2 Hub
Google
gdrive
Get File

L2 Construct: get_file

drive google

Description

GetFileIdByName retrieves the Google Drive file ID for a given file name. It searches for files with the specified name and returns the ID of the first matching file.

L2 Data

  1. Provider: google
  2. Module: gdrive
  3. Action: get_file

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "google",
    "module": "gdrive",
    "action": "get_file",
    "metadata": {}
  }
}
 

Input

Example

{
  "file_name": "Monthly_Report_For_2024_Template"
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gdrive/get-file-input",
  "$ref": "#/$defs/GetFileInput",
  "$defs": {
    "GetFileInput": {
      "properties": {
        "file_name": {
          "type": "string"
        },
        "folder_id": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["file_name"]
    }
  }
}
 

Output

Example

{
  "file_id": "1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc",
  "file_name": "Monthly_Report_For_2024_Template",
  "folder_id": "1GCZk30XFjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C8Xwe",
  "error": {
    "is_error": false
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gdrive/get-file-output",
  "$ref": "#/$defs/GetFileOutput",
  "$defs": {
    "GetFileOutput": {
      "properties": {
        "file_id": {
          "type": "string"
        },
        "file_name": {
          "type": "string"
        },
        "folder_id": {
          "type": "string"
        },
        "error": {
          "$ref": "#/$defs/HandlerError"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["file_id", "file_name", "error"]
    },
    "HandlerError": {
      "properties": {
        "is_error": {
          "type": "boolean"
        },
        "errors": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["is_error"]
    }
  }
}