API Methods
Registration
http://${EXTENSION_API_ADDR}/extension/register
Extensions deployed by processes can receive events only after the extensions have been registered with FunctionGraph. Use environment variable EXTENSION_API_ADDR to obtain the extension API registration address provided by FunctionGraph. For example, for Python, use the os.getenv("EXTENSION_API_ADDR") method to obtain the registration address.
Path
- /extension/register
Method
– POST
Request Headers
FunctionGraph-Extension-Name: Complete file name of an extension. Mandatory: yes. Type: string.
FunctionGraph-Extension-Address: Address of the server that receives invocation events. Mandatory: yes. Type: string. Example: 127.0.0.1:8081.
- FunctionGraph uses the complete file name of an extension to check whether the extension has been imported for booting. The request header for registering the extension must contain the IP address and port number of the HttpServer started by the extension. Example:
headers = { 'Content-type': 'application/json', 'FunctionGraph-Extension-Name': "extensionDemo.sh" 'FunctionGraph-Extension-Address': "127.0.0.1:8011" }
- A maximum of 10 extensions are supported. The HttpServer IP address and port number must be within 127.0.0.1:8081 and 127.0.0.1:8090, and the port number of each extension must be unique.
Body Parameters
Omitted
Response Codes
200 - The response body contains the function name, function version, and handler name.
Other codes indicate errors.
Example response body
{ "functionName": "helloWorld", "functionVersion": "$LATEST", "errorInfo": { "errorType": "", "errorMessage": "" } }
Invocation
http://${FunctionGraph-Extension-Address}/extension/invoke
After registration, the created HttpServer listens to this path to receive function invocation events.
Path
- /extension/register
Method
– POST
Body Parameters
traceId - Request ID.
invokedFunctionUrn - Function URN.
Response Codes
200 - The response body contains the function name, function version, and handler name.
Other codes indicate errors.
Example response body
{ "traceId": "3da1f2dc-3222-475e-9205-e2e6c6318895", "invokedFunctionUrn": "sn:cn:yrk:1111:function:0@test@hello:latest" }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.