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#
OpenAPI Spec
OpenAPI Spec
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 tonull. - 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
500status code. - Don't set an array to
null. Depending on the field, FusionAuth clears the array or returns a500status code.
To remove values from an array, PUT the full object, or set the Content-Type to one of the following media types:
application/json-patch+jsonfor JSON Patch (RFC 6902)application/merge-patch+jsonfor JSON Merge Patch (RFC 7396)
For more information, see The PATCH HTTP Method.
FusionAuth ignoreslambda.type on PATCH and PUT. To use a different lambda type, create a new Lambda.Path Parameters#
lambdaIdThe unique Id of the Lambda to update.
Request Body#
lambda.body The lambda function body, a JavaScript function.
lambda.debug Whether or not debug event logging is enabled for this Lambda.
lambda.enabled This value is not used, and may be removed in a future version.
lambda.engineType The JavaScript execution engine for the lambda. The possible values are:
GraalJSNashornDeprecated since1.35.0, Removed in1.49.0
lambda.name The name of the lambda.
{
"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.
| Code | Description |
|---|---|
| 200 | The request succeeded. The response contains a JSON body. |
| 400 | The 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. |
| 401 | FusionAuth 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. |
| 404 | The object you're updating doesn't exist. The response is empty. |
| 500 | FusionAuth 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 The lambda function body, a JavaScript function.
lambda.debug Whether or not debug event logging is enabled for this Lambda.
lambda.enabled This value is not used, and may be removed in a future version.
lambda.engineType The JavaScript execution engine for the lambda. The possible values are:
GraalJSNashornDeprecated since1.35.0, Removed in1.49.0
lambda.id The Id of the Lambda.
lambda.insertInstant The instant that the lambda created.
lambda.lastUpdateInstant The instant that the lambda was last updated.
lambda.name The name of the lambda.
lambda.type The lambda type. The possible values are:
AppleReconcileCimdClientRegistrationClientCredentialsJWTPopulateEpicGamesReconcileExternalJWTReconcileFacebookReconcileGoogleReconcileHYPRReconcileJWTPopulateLDAPConnectorReconcileLinkedInReconcileLoginValidationMFARequirementNintendoReconcileOpenIDReconcileSAMLv2PopulateSAMLv2ReconcileSCIMServerGroupRequestConverterSCIMServerGroupResponseConverterSCIMServerUserRequestConverterSCIMServerUserResponseConverterSelfServiceRegistrationValidationSonyPSNReconcileSteamReconcileTokenExchangePolicyTokenExchangePopulateTwitchReconcileTwitterReconcileUserInfoPopulateXboxReconcile
{
"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"
}
}Related
API documentation for the FusionAuth Create a Lambda API.
API documentation for the FusionAuth Delete a Lambda API.
Learn about the APIs for creating, retrieving, updating and deleting lambdas.
API documentation for the FusionAuth Retrieve a Lambda API.