Hello chaps. I’ve got a c# azure function. Can I...
# ask-community
j
Hello chaps. I’ve got a c# azure function. Can I use this to invoke the prefect cloud to schedule a job? Or rather invoke a job?
b
Hello! You could make an an API call to Prefect from your C# Azure Function. It would look something like this: 1. Retrieve an API key from Prefect, which is needed to authenticate your requests. 2. Include a reference to
System.Net.Http
in your C# Azure Function for making HTTP requests. 3. Instantiate an
HttpClient
, and set the required headers, with the API key as a Bearer token. 4. Create a JSON string representing a POST request to create a new flow run (use the flow's ID). 5. Send the POST request to the Prefect REST API and verify the response. You can read the REST API documentation at https://app.prefect.cloud/api/docs.