Update a Lambda API

On this page

This API is used to update an existing Lambda.

You must specify all of the properties of the Lambda when calling this API with the PUT HTTP method. When used with PUT, this API doesn't merge the existing Lambda and your new data. It replaces the existing Lambda with your new data.

Utilize the PATCH HTTP method to send specific changes to merge into an existing Lambda.

The lambda type may not be changed.

Request#

Global API Key Authentication
Update the Lambda with the given Id
PUT/api/lambda/{lambdaId}
OpenAPI Spec
PATCH/api/lambda/{lambdaId}
OpenAPI Spec
Note

For backward compatibility, a PATCH request with a Content-Type of application/json accepts the same body as the PUT request. FusionAuth merges the request into the existing object:

  • FusionAuth keeps every field that the request leaves out, so send only the fields you want to change.
  • FusionAuth merges a map, such as data, by key. To remove a key, set the key to null.
  • FusionAuth appends the values in a request array to the existing array, unless this API documents otherwise. An empty array leaves the existing array unchanged, so you can't remove values from an appending array.
  • FusionAuth adds each object in an array of objects as a new element. FusionAuth doesn't match the object to an existing element by Id or by position.
  • Don't send a value that an array of Ids already contains, such as a key Id or a Tenant Id. Some of these arrays then return a 500 status code.
  • Don't set an array to null. Depending on the field, FusionAuth clears the array or returns a 500 status code.

To remove values from an array, PUT the full object, or set the Content-Type to one of the following media types:

For more information, see The PATCH HTTP Method.

FusionAuth ignores lambda.type on PATCH and PUT. To use a different lambda type, create a new Lambda.

Path Parameters#

lambdaId
  • Type: UUID
  • Required
  • Immutable

The unique Id of the Lambda to update.

Request Body#

lambda.body
  • Type: String
  • Required

The lambda function body, a JavaScript function.

lambda.debug
  • Type: Boolean
  • Optional
  • Defaults to false

Whether or not debug event logging is enabled for this Lambda.

lambda.enabled
  • Type: Boolean
  • Optional
  • Defaults to true
  • Deprecated

This value is not used, and may be removed in a future version.

lambda.engineType
  • Type: String
  • Required
  • Defaults to GraalJS
  • Available since 1.35.0

The JavaScript execution engine for the lambda. The possible values are:

  • GraalJS
  • Nashorn Deprecated since 1.35.0, Removed in 1.49.0
lambda.name
  • Type: String
  • Required

The name of the lambda.

Example Request JSON
{
  "lambda": {
    "body": "function reconcile(one, two) { console.log('Hello world'); }",
    "debug": false,
    "engineType": "GraalJS",
    "name": "Name"
  }
}

Response#

The response for this API contains the Lambda that was updated.

Response Codes
CodeDescription
200The request succeeded. The response contains a JSON body.
400The request was invalid or malformed. The response contains an Errors JSON object with the specific errors. FusionAuth also returns a 400 when the request needs a paid FusionAuth license and no license is present.
401FusionAuth didn't authorize the request. The Authorization header is missing, the API key isn't valid, or the API key doesn't have permission for this endpoint and method. The response is empty. For more information, see Unauthorized Responses.
404The object you're updating doesn't exist. The response is empty.
500FusionAuth had an internal error and logged a stack trace in the FusionAuth log files. The response usually contains an Errors JSON object with the [Exception] general error code. On MySQL, a data field larger than the database column also returns 500. For more information, see Data Field Sizes.

Response Body#

lambda.body
  • Type: String

The lambda function body, a JavaScript function.

lambda.debug
  • Type: Boolean

Whether or not debug event logging is enabled for this Lambda.

lambda.enabled
  • Type: Boolean
  • Deprecated

This value is not used, and may be removed in a future version.

lambda.engineType
  • Type: String

The JavaScript execution engine for the lambda. The possible values are:

  • GraalJS
  • Nashorn Deprecated since 1.35.0, Removed in 1.49.0
lambda.id
  • Type: UUID

The Id of the Lambda.

lambda.insertInstant
  • Type: Long

The instant that the lambda created.

lambda.lastUpdateInstant
  • Type: Long

The instant that the lambda was last updated.

lambda.name
  • Type: String

The name of the lambda.

lambda.type
  • Type: String

The lambda type. The possible values are:

  • AppleReconcile
  • CimdClientRegistration
  • ClientCredentialsJWTPopulate
  • EpicGamesReconcile
  • ExternalJWTReconcile
  • FacebookReconcile
  • GoogleReconcile
  • HYPRReconcile
  • JWTPopulate
  • LDAPConnectorReconcile
  • LinkedInReconcile
  • LoginValidation
  • MFARequirement
  • NintendoReconcile
  • OpenIDReconcile
  • SAMLv2Populate
  • SAMLv2Reconcile
  • SCIMServerGroupRequestConverter
  • SCIMServerGroupResponseConverter
  • SCIMServerUserRequestConverter
  • SCIMServerUserResponseConverter
  • SelfServiceRegistrationValidation
  • SonyPSNReconcile
  • SteamReconcile
  • TokenExchangePolicy
  • TokenExchangePopulate
  • TwitchReconcile
  • TwitterReconcile
  • UserInfoPopulate
  • XboxReconcile
Example Response JSON
{
  "lambda": {
    "id": "7e66bac3-fa41-47fb-b8fd-12b35b5e1807",
    "body": "function reconcile(user, registration, samlResponse) { registration.roles = samlResponse.assertion.attributes['roles'] || [];}",
    "name": "Name",
    "debug": false,
    "enabled": true,
    "engineType": "GraalJS",
    "insertInstant": 1572469040579,
    "lastUpdateInstant": 1595361143101,
    "type": "SAMLv2Reconcile"
  }
}