REST API - Post
This function block allows you to send data to a specified REST API endpoint using a POST request. It is suitable for integrating your application with external services through an API.
📥 Inputs
Enable Condition
A boolean input that controls whether the POST request is sent. If set to true, the request will be executed.
Server Address
The URL of the server where the data should be posted.
Data ID
A string identifier for the data being sent. This serves as a key in the JSON object.
Data
The actual data to be sent to the server. This can be any type of data that needs to be posted.
📤 Outputs
Status Code
This output provides the HTTP status code returned from the server, indicating the success or failure of the request.
Error
This output returns an error message if the request failed.
Response
This output provides the response text received from the server.
🕹️ Controls
Timeout (s)
This field allows you to set a timeout duration for the request in seconds. If the server does not respond within this time, the request will fail.
🎨 Features
Dynamic Request Configuration
The ability to specify a server address, data ID, and payload dynamically allows for flexible integration with various APIs.
Comprehensive Feedback
Outputs include status code, potential error messages, and responses, making it easy to debug and validate the request.
📝 Usage Instructions
Enable Condition: Connect a boolean signal to the
Enable Condition
input to allow or disallow the request to be sent.Set Server Address: Enter the server address in the
Server Address
input.Define Data ID: Provide a string identifier for your data.
Provide Data: Connect or input the data you wish to post.
Set Timeout: Optionally, set the timeout duration for the request.
Evaluate: Run the block to send the data to the API, and review the outputs for status code, response, or errors.
📊 Evaluation
This function block evaluates the inputs to send a POST request to the configured REST API and provides outputs to allow you to handle the response effectively.
💡 Tips and Tricks
🛠️ Troubleshooting
Last updated