Magic Cloud

An Open Source Application Generator


Magic Lambda HTTP

Provides HTTP REST capabilities for Magic. More specifically this project provides the following 4 slots.

The [http.put] and the [http.post] slots requires you to provide a [payload], which will be pass to the endpoint as a string. All 4 endpoints can (optionally) take a [token] arguments, which will be transferred as a Bearer Authorization token to the endpoint, in the HTTP Authorization header of your request.

Notice, if you want to have more control over your HTTP request, you can also explicitly add your own [header] collection, which will become the HTTP request’s headers, where the header name is the name of the node, and its value is the value of the node. Below is a simple example of retrieving the document found at the specified URL, using a simple GET HTTP request, without neither a [token] nor [header] collection.

http.get:"https://google.com"

Posting, putting and patching data

The POST, PUT and PATCH slots, requires a [payload] argument, which becomes the body of the request. Below is an example illustrating how to create a POST request, with a Bearer token to access the end resource.

http.post
   token:qwerty_secret_JWT_token_goes_here
   payload:some mumbo jumbo payload, typically JSON and not text though ...

HTTP headers

Below is another example invoking DELETE with an explicit [headers] collection.

http.delete:"https://foo-url.com"
   headers
      Accept:application/zip
      X-Foo:Bar-Header-Value

Project website

The source code for this repository can be found at github.com/polterguy/magic.lambda.http, and you can provide feedback, provide bug reports, etc at the same place.

Quality gates

License

This project is the copyright(c) 2020-2021 of Thomas Hansen thomas@servergardens.com, and is licensed under the terms of the LGPL version 3, as published by the Free Software Foundation. See the enclosed LICENSE file for details.