-
Notifications
You must be signed in to change notification settings - Fork 8
GET and DELETE
The simplest HTTP requests you can make with Swiftlet are GET
and DELETE
since in their most elementary form they only require a web URL. This page illustrates how to make these requests using Swiftlet's Grasshopper components.
In order to make a GET
request with Swiftlet, pass the URL of the resource you are trying to reach to the appropriate input of the GET Request (GET) component. Make sure that your URL starts with a scheme (http://
or https://
) and does not contain query params (those are passed separately):
As you can see, the Status (S) output returns the HTTP Status Code, which in our case is 200 (OK). This means that our HTTP call was successful. The text body of the web response is returned via the Content (C) output. In this case we are getting the HTML markup of Google's landing page. We can also use the exact same setup to call an API endpoint. Below we are using Swiftlet's GET component to access World Time API and fetch the JSON array of valid locations in Europe:
Swiftlet's DELETE component (DELETE) works in the exact same way as GET. It accepts a URL that, again, has to start with a scheme (http://
or https://
) and must not contain a query string. Here it is in action: