Updated on 2026-10-27 GMT+08:00

Creating a Dependency

Function

This API is used to create a dependency.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

URI

POST /v2/{project_id}/fgs/dependencies

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description:

Project ID. For details, see Obtaining a Project ID.

Constraints:

None

Value range:

32 characters, including letters and digits.

Default value:

None

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

User token.

The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints:

None

Value range:

None

Default value:

None

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

depend_file

No

String

This parameter is mandatory when depend_type is set to zip. It is in the file stream format and must be a ZIP file encoded using Base64. The size of the ZIP file cannot exceed 40 MB. For a larger file, upload it through OBS.

depend_link

No

String

URL of the dependency in the OBS console when depend_type is set to obs.

depend_type

Yes

String

Import mode. Options: obs and zip.

runtime

Yes

String

Parameter description:

Runtime of the function, that is, the function execution environment.

Constraints

None

Range

  • Java8: Java 8

  • Java11: Java 11

  • Java17: Java 17

  • Java21: Java 21

  • Python2.7: Python 2.7

  • Python3.6: Python 3.6

  • Python3.9: Python 3.9

  • Python3.10: Python 3.10

  • Python3.12: Python 3.12

  • Go1.x: Go 1.x

  • Node.js6.10: Nodejs 6.10

  • Node.js8.10: Nodejs 8.10

  • Node.js10.16: Nodejs 10.16

  • Node.js12.13: Nodejs 12.13

  • Node.js14.18: Nodejs 14.18

  • Node.js16.17: Nodejs 16.17

  • Node.js18.15: Nodejs 18.15

  • Node.js20.15: Nodejs 20.15

  • C#(.NET Core 2.1): C# 2.1

  • C#(.NET Core 3.1): C# 3.1

  • C#(.NET Core 6.0): C# 6.0

  • C#(.NET Core 8.0): C# 8.0

  • Custom: custom runtime

  • PHP7.3: Php 7.3

  • PHP8.3: Php 8.3

  • Cangjie1.0

  • Cangjie0.52.3

  • HTTP

Custom image-based functions

Default Value

None

name

Yes

String

Dependence name. It can contain a maximum of 96 characters, and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), periods (.), and hyphens (-) are allowed.

description

No

String

Description of the dependency, which can contain a maximum of 512 characters.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

String

Dependence version ID.

owner

String

Dependency owner.

link

String

URL of the dependency in the OBS console.

runtime

String

Parameter description:

Runtime of a FunctionGraph function, that is, the function execution environment.

Range

  • Java8: Java 8

  • Java11: Java 11

  • Java17: Java 17

  • Java21: Java 21

  • Python2.7: Python 2.7

  • Python3.6: Python 3.6

  • Python3.9: Python 3.9

  • Python3.10: Python 3.10

  • Python3.12: Python 3.12

  • Go1.x: Go 1.x

  • Node.js6.10: Nodejs 6.10

  • Node.js8.10: Nodejs 8.10

  • Node.js10.16: Nodejs 10.16

  • Node.js12.13: Nodejs 12.13

  • Node.js14.18: Nodejs 14.18

  • Node.js16.17: Nodejs 16.17

  • Node.js18.15: Nodejs 18.15

  • Node.js20.15: Nodejs 20.15

  • C#(.NET Core 2.1): C# 2.1

  • C#(.NET Core 3.1): C# 3.1

  • C#(.NET Core 6.0): C# 6.0

  • C#(.NET Core 8.0): C# 8.0

  • Custom: custom runtime

  • PHP7.3: Php 7.3

  • PHP8.3: Php 8.3

  • Cangjie1.0

  • Cangjie0.52.3

  • HTTP

Custom image-based functions

etag

String

Dependency ID.

size

Long

Dependency size.

name

String

Dependency name.

description

String

Dependency description.

file_name

String

Dependency file name.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 503

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

  • Create a dependency by directly uploading a ZIP file.

    POST https://{Endpoint}/v2/{project_id}/fgs/dependencies
    
    {
      "depend_file" : "xxx",
      "depend_type" : "zip",
      "runtime" : "Node.js8.10",
      "name" : "xxx"
    }
  • Create a dependency by uploading a ZIP file from OBS.

    POST https://{Endpoint}/v2/{project_id}/fgs/dependencies
    
    {
      "depend_link" : "https://{bucket}.{obs_endpoint}/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip",
      "depend_type" : "obs",
      "runtime" : "Node.js8.10",
      "name" : "xxx"
    }

Example Responses

Status code: 200

{
  "id" : "4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3",
  "owner" : "*****",
  "link" : "https://{bucket}.{obs_endpoint}/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip",
  "runtime" : "Python3.6",
  "etag" : "83863be4b6c3a86aef995dbc83aae68f",
  "size" : 577118,
  "name" : "python-kafka",
  "description" : "Python library for Kafka operations.",
  "file_name" : "python-kafka.zip"
}

Status Codes

Status Code

Description

200

ok

400

Bad request.

401

Unauthorized.

403

Forbidden.

404

Not found.

500

Internal server error.

503

Service unavailable.

Error Codes

See Error Codes.