Post Request

To make a POST request using the FireflyAIO Lua API, you have two possible approaches depending on whether you need to send additional content with your request.

Simple POST Request

If you only need to send a POST request with headers and no additional content, use the following code:

-- Add a header to your request
AddHeader("Name", "Value")

-- Send a POST request to the specified URL
local response = Post("https://example.com")

In this example, replace "Name" and "Value" with the appropriate header name and value for your request. The URL "https://example.com" should be replaced with the endpoint you want to access.

POST Request with Content

If you need to send content along with your POST request, use the following code:

-- Add a header to your request
AddHeader("Name", "Value")

-- Send a POST request to the specified URL with content and content type
local response = Post("https://example.com", "Content", "Content-Type")

In this example, replace "Name" and "Value" with the appropriate header name and value, "Content" with the data you want to send, and "Content-Type" with the MIME type of the content (e.g., "application/json" for JSON data).

By following these steps, you can easily perform POST requests within your custom checkers in FireflyAIO, tailored to your specific requirements.

Last updated