POST
/
cloud
/
v1
/
faas
/
namespaces
/
{project_id}
/
{region_id}
/
{namespace_name}
/
functions
curl --request POST \
  --url https://api.gcore.com/cloud/v1/faas/namespaces/{project_id}/{region_id}/{namespace_name}/functions \
  --header 'APIKey: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "autoscaling": {
    "max_instances": 2,
    "min_instances": 1
  },
  "code_text": "def main():\n    return '\''Hello World'\''",
  "dependencies": "numpy==1.21.0\npandas==1.3.0",
  "description": "This is a sample function.",
  "enable_api_key": true,
  "envs": {
    "ENV_VAR": "value"
  },
  "flavor": "64m-64MB",
  "main_method": "handler",
  "name": "function-name",
  "runtime": "python3.7.12",
  "timeout": 5
}'
{
  "tasks": [
    "d478ae29-dedc-4869-82f0-96104425f565"
  ]
}

Authorizations

APIKey
string
header
required

API key for authentication.

Path Parameters

project_id
integer
required

Project ID

Examples:

1

region_id
integer
required

Region ID

Examples:

1

namespace_name
string
required

Namespace name

Examples:

"namespace-name"

Body

application/json

Response

200 - application/json

OK

The response is of type object.