Instructions
The next steps will guide you on how to use this component. In the end, you should have an action that will allow a request-response protocol between the OutSystems platform and an external server.
The Demo application uses the https://httpbin.org/ service to test the multiple types of HTTP Requests. You can also use any other endpoint to test it.
1. Create the dependencies that allow the usage of the component
The actions HTTPGet, HTTPPost, HTTPPut, HTTPDelete, are used to make requests to the URL provided and receive the response.To use them, add a dependency in your application according to the picture below.
2. Using the HTTPGet and HTTPDelete actions
Create a server action and call the "HTTPGet" action if you want to use the GET operation to fetch data or the “HTTPDelete” action if you want to use the DELETE operation to remove data.
Fill the input parameter "URL" with the URL that will be used in the request. It must include either "http://" or "https://".You can optionally pass a list of "HttpHeader" (name and value of the header to be sent) using the Headers input parameter.If the endpoint being called requires Basic Authentication, you can also pass the values for the Username and Password input parameters.See below an example:
When the action is called, you will receive the Status, Status Code, Response text, and the list of Response Headers.
3. Using the HTTPPost and HTTPPut actions
Create a server action and call the "HTTPPost" action if you want to use the POST operation to send data or the “HTTPPut” action if you want to use the PUT operation to update data.
Fill the input parameter "URL" with the URL that will be used in the request. It must include either "http://" or "https://".You will also need to fill in the Data input parameter with the content you want to send.You can optionally pass a list of "HttpHeader" (name and value of the header to be sent) using the Headers input parameter.The Content-Type header value will be ignored in favor of the Content_Type Variable.If the endpoint being called requires Basic Authentication, you can also pass the values for the Username and Password input parametersSee below an example