> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # GetFunctionTemplate # Package: functions # Namespace: FunctionTemplates # Method link: https://dev.wix.com/docs/api-reference/business-management/functions/function-templates/get-function-template.md ## Permission Scopes: Manage Functions: SCOPE.DC-FUNCTIONS.MANAGE-FUNCTIONS ## Introduction Retrieves a function template by ID. --- ## REST API ### Schema ``` Method: getFunctionTemplate Description: Retrieves a function template by GUID. URL: https://www.wixapis.com/api/functions/v1/templates/{appDefId}/{functionTemplateId} Method: GET # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: functionTemplateId, appDefId Method parameters: param name: appDefId | type: none | required: true param name: functionTemplateId | type: none | required: true Return type: GetFunctionTemplateResponse - name: functionTemplate | type: FunctionTemplate | description: The requested function template. - name: functionId | type: string | description: GUID of the function built to create this template. This is the function that was built by the business solution to create the template. - name: originFunctionId | type: string | description: GUID of the original function that was copied to create this template. - name: originMetaSiteId | type: string | description: GUID of the Wix site where the original function was created. - name: displayName | type: string | description: Display name. This is the name used in the function builder in the [dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ffunctions/manage). - name: displayDescription | type: string | description: Description of what the function template's logic does. - name: appDefId | type: string | description: App GUID of the business solution that created this template. This is the same as the app GUID of the business solution that created the template's function type. - name: id | type: string | description: Function template GUID. - name: version | type: string | description: Function template version. This changes when the business solution updates the template. - name: functionExtensionId | type: string | description: GUID of the function type that this template was created from. - name: formTemplateExtensionId | type: string | description: GUID of the form template to use for [builderless creation](https://dev.wix.com/docs/api-reference/business-management/functions/builderless-productions/create-function-builderless-production.md). Specify this GUID when calling [List Forms](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/list-forms.md) to retrieve the form values to use for builderless creation. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: FUNCTION_TEMPLATE_NOT_FOUND | Description: Couldn't find the function template associated with the specified app. ``` ### Examples ### Get Function Template ```curl curl -X GET \ https://www.wixapis.com/api/functions/v1/templates/{app_def_id}/{function_template_id} \ -H 'Authorization: ' \ -H "Content-Type: application/json" \ -d '{ "appDefId": "d49080e4-7b60-4dd4-b18a-f7ba7856bf27", "functionTemplateId": "63e22cb3-8b0b-4015-967a-5b865838e013" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.functions.FunctionTemplates.getFunctionTemplate(identifiers) Description: Retrieves a function template by GUID. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: identifiers.appDefId, identifiers.functionTemplateId, identifiers Method parameters: param name: identifiers | type: GetFunctionTemplateIdentifiers none | required: true - name: appDefId | type: string | description: GUID of the app that owns the function template. | required: true - name: functionTemplateId | type: string | description: GUID of the function template to retrieve. | required: true Return type: PROMISE - name: functionId | type: string | description: GUID of the function built to create this template. This is the function that was built by the business solution to create the template. - name: originFunctionId | type: string | description: GUID of the original function that was copied to create this template. - name: originMetaSiteId | type: string | description: GUID of the Wix site where the original function was created. - name: displayName | type: string | description: Display name. This is the name used in the function builder in the [dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ffunctions/manage). - name: displayDescription | type: string | description: Description of what the function template's logic does. - name: appDefId | type: string | description: App GUID of the business solution that created this template. This is the same as the app GUID of the business solution that created the template's function type. - name: _id | type: string | description: Function template GUID. - name: version | type: string | description: Function template version. This changes when the business solution updates the template. - name: functionExtensionId | type: string | description: GUID of the function type that this template was created from. - name: formTemplateExtensionId | type: string | description: GUID of the form template to use for [builderless creation](https://dev.wix.com/docs/api-reference/business-management/functions/builderless-productions/create-function-builderless-production.md). Specify this GUID when calling [List Forms](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/list-forms.md) to retrieve the form values to use for builderless creation. Possible Errors: HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: FUNCTION_TEMPLATE_NOT_FOUND | Description: Couldn't find the function template associated with the specified app. ``` ### Examples ### getFunctionTemplate ```javascript import { functionTemplates } from '@wix/functions'; async function getFunctionTemplate(identifiers) { const response = await functionTemplates.getFunctionTemplate(identifiers); }; ``` ### getFunctionTemplate (with elevated permissions) ```javascript import { functionTemplates } from '@wix/functions'; import { auth } from '@wix/essentials'; async function myGetFunctionTemplateMethod(identifiers) { const elevatedGetFunctionTemplate = auth.elevate(functionTemplates.getFunctionTemplate); const response = await elevatedGetFunctionTemplate(identifiers); } ``` ### getFunctionTemplate (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { functionTemplates } from '@wix/functions'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { functionTemplates }, // Include the auth strategy and host as relevant }); async function getFunctionTemplate(identifiers) { const response = await myWixClient.functionTemplates.getFunctionTemplate(identifiers); }; ``` ---