POST
/api/v1/faas/functions/
curl --request POST \ --url 'https://api.e2enetworks.com/myaccount/api/v1/faas/functions/?project_id=<PROJECT_ID>&location=<LOCATION>&apikey=<API_KEY>' \ --header 'Authorization: Bearer <API_TOKEN>'import requests
response = requests.post( "https://api.e2enetworks.com/myaccount/api/v1/faas/functions/", params={"project_id": "<PROJECT_ID>", "location": "<LOCATION>", "apikey": "<API_KEY>"}, headers={"Authorization": "Bearer <API_TOKEN>"},)print(response.json())const url = new URL("https://api.e2enetworks.com/myaccount/api/v1/faas/functions/");url.search = new URLSearchParams({ project_id: "<PROJECT_ID>", location: "<LOCATION>", apikey: "<API_KEY>" });
const response = await fetch(url, { method: "POST", headers: { "Authorization": "Bearer <API_TOKEN>" },});console.log(await response.json());Creates a new function with provided configurations and uploads the code file.
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”project_id
required
integer
Project ID Find your project id here
location
required
string
Deployment region for the resource. Accepted values: Delhi, Chennai.
Mumbai region has been discontinued. Delhi and Chennai are the only supported regions.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
function_name
required
Unique name for the function
string
Example
e2e-function-55619runtime
required
Runtime environment
string
Example
python-3.11-fastapimemory
required
Memory allocated to the function (in MB)
string
Example
128timeout
required
Timeout for the function (in seconds)
string
Example
15environment_variables
required
JSON string of environment variables
string
Example
{ "env_name": "env_value"}code_file
required
Zipped function source code (.zip file)
string format: binary
Responses
Section titled “Responses”Function created successfully
Media typeapplication/json
object
code
integer
data
object
files
Array<object>
object
file_path
string
content
string
id
integer
errors
object
message
string
Example
{ "code": 200, "data": { "files": [ { "file_path": "e2e-function-91786/func.py", "content": "from fastapi import FastAPI, Request\nfrom fastapi.middleware.cors import CORSMiddleware\nfrom pydantic import BaseModel\n\napp = FastAPI()\napp.add_middleware(CORSMiddleware, allow_origins=[\"*\"], allow_methods=[\"*\"], allow_headers=[\"*\"])\n\nclass Payload(BaseModel):\n name: str = \"World\"\n\n@app.get(\"/\")\nasync def get_handler():\n return {\"message\": \"Hello from FastAPI GET\"}\n\n@app.post(\"/\")\nasync def post_handler(payload: Payload):\n return {\"message\": f\"Hello, {payload.name}!\"}\n" } ], "id": 185 }, "errors": {}, "message": "Success"}