Create a File Sensor API

POST /api/v1.2/file_sensor

Use this API to create a file sensor API. Airflow uses it for programmatically monitoring workflows.

Required Role

The following users can make this API call:

  • Users who belong to the system-user or system-admin group.

  • Users who belong to a group associated with a role that allows creating a sensor. See Managing Groups and Managing Roles for more information.

Parameters

Note

Parameters marked in bold below are mandatory. Others are optional and have default values.

Parameter

Description

files

An array of the file’s location that needs monitoring.

Request API Syntax

curl -X POST -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"files": "["<file1 location>", "<file2 location>]" }' \ "https://api.qubole.com/api/v1.2/sensors/file_sensor"

Note

The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.

Sample API Request

The following example creates a file sensor on AWS:

curl -X POST -H "X-AUTH-TOKEN: $AUTH_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"files": "["s3://abc/xyz", "s3://abc/123"]" }' \ "https://api.qubole.com/api/v1.2/sensors/file_sensor"

The requests with 200 response code will have just a status field which will either contain true or false. The requests with 422 response code will contain the error message as well.

{"status": "true"}
{"error": {"error_code": 422, "error_message": "File list is missing or not in array format"}}