Complete the code to define an HTTP trigger function in Azure Functions.
def main(req: func.HttpRequest) -> func.HttpResponse: if req.method == '[1]': return func.HttpResponse('Hello HTTP!')
The HTTP trigger listens for HTTP requests. The most common method to respond to is GET.
Complete the code to set a Timer trigger schedule to run every 5 minutes.
timer = func.TimerRequest(schedule='[1]')
The cron expression 0 */5 * * * * means every 5 minutes at second 0.
Fix the error in the Blob trigger binding path to listen to the container named 'images'.
blob_trigger = func.InputStream('[1]/{name}')
The binding path must match the exact container name, which is images.
Fill both blanks to define a Queue trigger function that listens to the 'tasks' queue and uses the correct parameter type.
def main(msg: [1]): logging.info(f'Received message: {msg.[2]')
The parameter type for a Queue trigger message is func.QueueMessage, and the message content is accessed via the content attribute.
Fill all three blanks to define an HTTP triggered Azure Function that reads a query parameter 'name' and returns a greeting.
def main(req: func.HttpRequest) -> func.HttpResponse: name = req.params.get('[1]') if not name: try: req_body = req.get_json() except ValueError: pass else: name = req_body.get('[2]') if name: return func.HttpResponse(f'Hello, [3]!') else: return func.HttpResponse('Please pass a name on the query string or in the request body.', status_code=400)
The query parameter and JSON key are both 'name', and the greeting uses the variable name.