lambdar-api: Lambdar API responses

Description Response format Handling the response

Description

This page sets out what your client application can expect to receive from a lambdar API call.

Response format

The API returns a JSON object the format of which varies depending on the outcome of the function.

Success

If the function returned successfully with no warnings the result will look like this:

1
2
3
4
{
  "status": "ok",
  "result": "<whatever the result is>"
}

Success but the function raised warning/s

If warnings are raised by the lambda function this will be noted in the response object:

1
2
3
4
5
{
  "status": "warning",
  "result" "<whatever the result is>",
  "warning_messages": "["warning_message_1", "warning_message_2", ...]"
}

Lambda function failed

If the lambda function raised an error the response will look like this:

1
2
3
4
{
  "status": "error",
  "error_message": "<error message>"
}

Lambdar runtime failed

If the lambdar runtime environment itself experienced an error, the response will look like this:

1
2
3
4
{
  "status": "runtime_error",
  "error_message": "<error message>"
}

Handling the response

To handle the result, check the value of the "status" field.


lewinfox/lambdar documentation built on Dec. 21, 2021, 10:43 a.m.