Querying Function Templates
Function
This API is used to query function templates.
URI
GET /v2/{project_id}/fgs/templates
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
marker |
No |
String |
Start position of the current query. The default value is 0. Default: 0 Minimum: 1 Maximum: 64 |
|
maxitems |
No |
String |
Maximum number of templates obtained in each query. |
|
ispublic |
No |
String |
Indicates whether the template is public. To query the public templates of a function, set this parameter to true. |
|
runtime |
No |
String |
Runtime template. |
|
scene |
No |
String |
Scenario template. |
|
service |
No |
String |
Cloud service template. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
|
Content-Type |
Yes |
String |
Message body type (format). |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
func_templates |
Array of ShowFunctionTemplateResponseBody objects |
Function templates. |
|
next_marker |
Integer |
Next read location. |
|
Parameter |
Type |
Description |
|---|---|---|
|
id |
String |
Template ID. |
|
type |
Integer |
Template type. |
|
title |
String |
Template title. |
|
template_name |
String |
Template name. |
|
description |
String |
Template description. |
|
runtime |
String |
Template runtime. |
|
handler |
String |
Template handler. |
|
code_type |
String |
Code type. |
|
code |
String |
Code file. |
|
timeout |
Integer |
Maximum duration the function can be executed. Value range: 3s–259,200s. |
|
memory_size |
Integer |
Memory size. |
|
trigger_metadata_list |
Array of TriggerMetadataList objects |
Trigger information. |
|
temp_detail |
TempDetail object |
|
|
user_data |
String |
User data. |
|
encrypted_user_data |
String |
Encrypted user data. |
|
dependencies |
Array of strings |
Dependencies required by the template. |
|
scene |
String |
Template application scenarios. |
|
service |
String |
Cloud service associated with the template. |
|
Parameter |
Type |
Description |
|---|---|---|
|
trigger_name |
String |
Trigger name. |
|
trigger_type |
String |
Trigger type. |
|
event_type |
String |
Event type. |
|
event_data |
String |
Event data. |
|
Parameter |
Type |
Description |
|---|---|---|
|
input |
String |
Template input. |
|
output |
String |
Template output. |
|
warning |
String |
Warning. |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Status code: 500
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Error code. |
|
error_msg |
String |
Error message. |
Example Requests
Query 500 public function templates.
GET /v2/{project_id}/fgs/templates?marker=0&maxitems=500&ispublic=true
Example Responses
Status code: 200
OK
{
"func_templates" : [ {
"id" : "d3aa6e4c-xxxx-xxxx-9c09-5c50c4xxxxxx",
"type" : 1,
"title" : "access-service-with-http",
"template_name" : "access-service-with-http-php",
"description" : "access service with http.",
"runtime" : "PHP7.3",
"handler" : "index.handler",
"code_type" : "inline",
"code" : "xxxxx",
"timeout" : 30,
"memory_size" : 256,
"trigger_metadata_list" : [ ],
"temp_detail" : {
"input" : "None",
"output" : "execution succeed: Return to access service information through http/https,",
"warning" : "1. configure the serveraddress environment variables."
},
"user_data" : "",
"encrypted_user_data" : "",
"dependencies" : [ ],
"scene" : "basic_function_usage",
"service" : "FunctionGraph"
} ],
"next_marker" : 1
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
400 |
Bad request. |
|
401 |
Unauthorized. |
|
403 |
Forbidden. |
|
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.