Publish Function

This API is applicable only to Java, Node JS, and Python functions. The function must have an unpublished draft version before it can be published. Deluge functions are automatically published when they are created or updated and cannot be published using this API.

Purpose

Use this API to publish an existing draft of a Java, Node JS, or Python function in your Zoho CRM account. You can optionally specify a changelog message for revision tracking. To identify functions with unpublished drafts, use the List Functions API and check whether the has_draft field is true ("has_draft": true).

Endpoints

  • POST /settings/functions/{function_identifier}/actions/publish

Here, {function_identifier} represents the unique ID or API name of the function. You can obtain the function ID or API name using the List Functions API.

Request Details

Request URL

{api-domain}/crm/{version}/settings/functions/{function_identifier}/actions/publish
Here, {function_identifier} represents the unique ID or API name of the function. You can obtain the function ID or API name using the List Functions API

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

ZohoCRM.settings.functions.CREATE
(or)
ZohoCRM.settings.functions.ALL
(or)
ZohoCRM.settings.ALL

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v8/settings/functions/5725767000011217012/actions/publish"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@function.json"

Input JSON

  • publishJSON object, optional

    Publish configuration object.

    • changelogstring, optional

      Specify a message describing the changes in the published revision. This message is stored in the function's revision history for tracking purposes.

Note

For Java functions, the system performs compilation checks when you publish the function. If the draft contains compilation errors, the API returns a COMPILATION_ERROR response.

Sample Input

Copied{
    "publish": {
      "changelog": "Fixed null pointer issue in record update"
    }
  }

Possible Errors

  • INVALID_DATAHTTP 400

    Invalid function ID
    Resolution: Specify a valid function ID. Use the list of Functions to retrieve the function ID. To publish a function, ensure the function has an unpublished draft by verifying that the has_draft field is true ("has_draft": true).

  • COMPILATION_ERRORHTTP 400

    The Java function contains compilation errors
    Resolution: Fix the compilation errors in the function and try publishing it again using the Update Funciton API.

  • CANNOT_PERFORM_ACTIONHTTP 400

    Function has already been published
    Resolution: The specified function does not have an unpublished draft available for publishing. Use the list of Functions to retrieve the Function ID, and ensure the has_draft field is true ("has_draft": true) before attempting to publish the function.

  • INVALID_REQUEST_METHODHTTP 400

    The http request method type is not a valid one
    Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to the Endpoints section for more details.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: The client does not have a valid scope to publish the function in Zoho CRM. Create a new access token with the required scope. Refer to the Scope section for more details.

  • AUTHENTICATION_FAILUREHTTP 401

    Authentication failed
    Resolution: Pass the access token in the request header of the API call.

  • NO_PERMISSIONHTTP 403

    Permission denied.
    Resolution: The user does not have permission to publish the specified function. Contact your Zoho CRM administrator to obtain the required permissions.

  • INVALID_URL_PATTERNHTTP 404

    Please check if the URL trying to access is a correct one
    Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to the Request URL section for more details.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in the server. Contact support team.

Sample Response

Copied{
    "publish": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "5725767000011217012"
            },
            "message": "function published successfully",
            "status": "success"
        }
    ]
}