Invoking Function With Universal HTTP API Gateway
Lyrid serverless platform also features an HTTP API Gateway where you can invoke your function publicly using Access Key and Secret Key.
API Endpoint
When you initialize an app, Lyrid will automatically generate an API Gateway for user to publicly invoke the function.
Requirements
Authorization
In order to access the API Gateway , you need to put an Authorization Header (Basic Auth) with:
Username = AccessKey
Password = SecretKey
We recommend you to generate a new public access key
In basic HTTP authentication, a request contains a header field in the form of
Authorization: Basic <credentials>
.
Where <credentials>
is the Base64 encoding of ID and password joined by a single colon username:password
.
HTTP Method
Every request made using the HTTP API Gateway will have the HTTP Method passed right to the function. Make sure to use the right method according to your function.
Supported Method
Currently the Universal API Gateway supports :
GET | POST | DELETE | PUT | PATCH | COPY | HEAD | OPTIONS | LINK | UNLINK | PURGE | LOCK | UNLOCK | PROPFIND | VIEW | CONNECT | TRACE |
---|
Additional Request Values
Header
User can also insert headers into the request as usual. The header will be propagated in the request.
Authorization inside Authorization
If you use Authorization inside your function, you can pass the header value as
X-Lyrid-Authorization: <value>
this will be propagated as
Authorization: <value>
into your function.
Currently this feature is disabled in GCP as it delivers a bug we're currently trying to fix.
Body
User can also send JSON value into body and it will also be propagated in the request.
NEVER send an NONE body in POST request, it will behave incorrectly in GCP. Instead, just send an empty {}
body.