Complete the code to import the SimpleHttpOperator from Airflow.
from airflow.providers.http.operators.http import [1]
The SimpleHttpOperator is the correct operator to make HTTP API calls in Airflow.
Complete the code to create a SimpleHttpOperator task that calls the 'get' method.
task = SimpleHttpOperator(
task_id='call_api',
method='[1]',
http_conn_id='my_api',
endpoint='data'
)The method parameter specifies the HTTP method. To retrieve data, use 'get'.
Fix the error in the SimpleHttpOperator code by completing the missing parameter for the connection ID.
task = SimpleHttpOperator(
task_id='call_api',
method='GET',
[1]='my_api',
endpoint='data'
)The correct parameter name for the HTTP connection ID in SimpleHttpOperator is http_conn_id.
Fill both blanks to create a SimpleHttpOperator that sends JSON data with a POST request.
task = SimpleHttpOperator(
task_id='post_data',
method='[1]',
http_conn_id='my_api',
endpoint='submit',
data=[2]
)To send data, use the POST method and provide a JSON dictionary in the data parameter.
Fill all three blanks to create a SimpleHttpOperator that calls a GET endpoint with headers and extracts the response.
task = SimpleHttpOperator(
task_id='get_with_headers',
method='[1]',
http_conn_id='my_api',
endpoint='info',
headers=[2],
response_filter=[3]
)The method is GET to retrieve data, headers include authorization, and response_filter processes the response JSON.