Skip to main content

/functions/rest/v1/namespaces/{id}/functions/{name} REST Method

Updates a Function.

Updated on
Jul 9, 2024

/functions/rest/v1/namespaces/{id}/functions/{name} REST Method

Path Parameters

id
string
REQUIRED
The ID of the namespace associated with this function.
name
string
REQUIRED
The name of this function.

Body Parameters

description
string
A description of your function. Accepts markdown.
kind
string
The runtime for your function. ENUM: "nodejs-qn:20", "python-qn:3.11"
code
string
The code for your function encoded in base64. This field accepts base64 encoded string containing your function code or a base64 encoded zip archive of your function and its dependencies.
binary
boolean
Indicates whether the code field contains a zip archive.
limits
object
An object containing the limits for your function.
timeout
integer
The maximum time in milliseconds that your function can run. Must be between 5000 and 60000
memory
integer
The maximum memory in MB that your function can use. Must be one of 128, 256, 512

Returns

name
string
The name of the function.
description
string
The description of your function.
namespace
string
The ID of the namespace associated with this function.
created_at
string
The timestamp when the function was created.
updated_at
string
The timestamp when the function was updated.
qn_account_id
string
The ID of the QuickNode account that created the function.
exec
object
The code attributes of the function.
kind
string
The runtime for your function. ENUM: "nodejs-qn:20", "python-qn:3.11"
code
string
The code for your function encoded in base64.
binary
boolean
Indicates whether the code field contains a zip archive.
limits
object
The limits for the function.
timeout
integer
The maximum time in milliseconds that your function can run.
memory
integer
The maximum memory in MB that your function can use.
concurrency
integer
The maximum number of concurrent executions of your function.
Request
1
curl -X PATCH \
2
"https://api.quicknode.com/functions/rest/v1/namespaces/{id}/functions/{name}" \
3
-H "accept: application/json" \
4
-H "Content-Type: application/json" \
5
-H "x-api-key: YOUR_API_KEY" \
6
-d $'{
7
"description": "MyFunction Description",
8
"kind": "nodejs-qn:20",
9
"code": "ZnVuY3Rpb24gbWFpbihwYXJhbXMpIHsKICAgIC8vIEV4dHJhY3QgZGF0YXNldCBhbmQgbmV0d29yayBmcm9tIG1ldGFkYXRhIGluIHBhcmFtcwogICAgY29uc3QgZGF0YXNldCA9IHBhcmFtcy5tZXRhZGF0YS5kYXRhc2V0OwogICAgY29uc3QgbmV0d29yayA9IHBhcmFtcy5tZXRhZGF0YS5uZXR3b3JrOwoKICAgIGNvbnNvbGUubG9nKGBUaGlzIGlzIGEgbG9nIGZyb20gdGhlICR7ZGF0YXNldH0gZGF0YXNldCBvbiB0aGUgJHtuZXR3b3JrfSBuZXR3b3JrLmApOwoKICAgIHJldHVybiB7IAogICAgICAgIG1lc3NhZ2U6IGBUaGlzIGlzIHRoZSByZXR1cm4gZnJvbSB0aGUgJHtkYXRhc2V0fSBkYXRhc2V0IG9uIHRoZSAke25ldHdvcmt9IG5ldHdvcmsuYCwKICAgICAgICBwYXJhbXMKICAgIH07Cn0=",
10
"binary": false,
11
"limits": {
12
"timeout": 5000,
13
"memory": 128
14
}
15
}'
16
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free