REST
Send REST requests with the REST built-in.
Request
Perform a request against a REST resource.
typescriptCopied1import airplane from "airplane";23export default airplane.task(4{5slug: "get_user_profiles",6// Attach REST resource to task7resources: ["profile_api"],8},9async (params) => {10const run = await airplane.rest.request<{ userId: string; avatar: string }>(11// Slug of the REST resource to query12"profile_api",13// REST method to execute14"GET",15// URL path16"/profile"17);18return run.output.response;19}20);
API
javascriptCopied1import airplane from "airplane";23export default airplane.task(4{5slug: "get_user_profiles",6// Attach REST resource to task7resources: ["profile_api"],8},9async (params) => {10const run = await airplane.rest.request(11// Slug of the REST resource to query12"profile_api",13// REST method to execute14"GET",15// URL path16"/profile"17);18return run.output.response;19}20);
API
pythonCopied1import airplane23@airplane.task(4resources=[5# Attach REST resource to task6airplane.Resource("profile_api"),7]8)9def get_user_profiles():10run = airplane.rest.request(11# Slug of the REST resource to query12rest_resource="profile_api",13# REST method to execute14method="GET",15# URL path16path="/profile",17)18return run.output["response"]
API