Hide operations (x-ntx-visibility)
In this example, you will add the x-ntx-visibility Specification Extension A Nintex-specific OpenAPI Specification key that allows special functionality within Nintex Xtensions. to the Google Task Xtension A set of instructions for Nintex Automation Cloud to use third-party API functionality with Nintex workflows. An Xtension may include workflow actions, start events, forms or file control. to hide the getListsoperation A single request to a third-party API. Operations often become actions in the workflow designer. from the Workflow designer. This operation is not useful as a workflow action A task that can be performed or triggered within a workflow, such as moving a file, sending an email, or using third-party API functionality., so we will hide it to avoid cluttering the Workflow designer. |
Not all operations, parameters A piece of information passed to a third-party API during a request. or responses The return from a third-party API after a request has been made by the client. represent useful actions or configuration fields when designing a workflow. Some operations may be designed as internal 'helper' operations, such as retrieving values for drop-down lists, while some parameters or responses may not relate to any workflow design. To avoid cluttering the Workflow designer with actions that should not be used in workflows, the x-ntx-visibility Specification Extension allows you to hide operations from the action toolbox, and configuration fields from the action panel.
The complete OpenAPI Specification A standard, language-agnostic description of RESTful APIs that can be read by both humans and machines. Formerly known as Swagger. and icon for this example are available here.
Tip: Want the short version? Check out our OpenAPI Specification quick reference for quick definitions of parameter types, authentication, file handling and Specification Extensions.
The following examples also use x-ntx-visibility:
- Rename fields (x-ntx-summary).
- Create dynamic fields (x-ntx-dynamic-schema).
- Accept an XML response
- Upload files by streaming
- Upload files by URL.
- Download files by URL.
- Download base64 files.
- Upload base64 files.
Also see the how-to onx-ntx-visibility.
Visibility
Nintex Automation Cloud uses the x-ntx-visibility Specification Extension to determine when to hide an action or configuration field. By defining x-ntx-visibility with a value of internal, you can hide:
- actions
- configuration fields for parameters
- configuration fields for responses
Nintex Automation Cloud displays the action and configuration field for any operation, parameter or response that:
- does not use the x-ntx-visibility specification extension
- defines x-ntx-visibility with any value other than internal
Nintex Xtensions also supports the Microsoft Flow format of this Specification Extension: x-ms-visibility. Only the internalvalue is supported.
Hide the operation
Step 1: Create the basic OpenAPI Specification
Use the specification you built to create a task in a Google Tasks list, or download the completed Google Tasks Xtension example here.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Google Tasks"
},
"host": "www.googleapis.com",
"basePath": "/tasks/v1",
"schemes": [ "https" ],
"produces": [ "application/json" ],
"paths": {
"/users/@me/lists": {
"get": {
"tags": [ "Task List" ],
"summary": "List Tasklists",
"description": "List Tasklists",
"operationId": "getlists",
"produces": [ "application/json" ],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/lists"
}
},
"default": {
"description": "Operation Failed"
}
},
"security": [
{
"oauth2": [ "https://www.googleapis.com/auth/tasks" ]
}
]
}
},
"/lists/{tasklist}/tasks": {
"post": {
"tags": [ "Task" ],
"summary": "Create Task",
"description": "Create Task",
"operationId": "createtask",
"produces": [ "application/json" ],
"parameters": [
{
"name": "tasklist",
"type": "string",
"in": "path",
"x-ntx-dynamic-values": {
"operationId": "getlists",
"value-collection": "items",
"value-path": "id",
"value-title": "title"
}
},
{
"name": "task",
"x-ntx-summary": "Task",
"description": "Title of task",
"in": "body",
"schema": {
"$ref": "#/definitions/taskSimple"
},
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/lists"
}
},
"default": {
"description": "Operation Failed"
}
},
"security": [
{
"oauth2": [ "https://www.googleapis.com/auth/tasks" ]
}
]
}
}
},
"definitions": {
"list": {
"type": "object",
"properties": {
"kind": {
"type": "string"
},
"updated": {
"type": "string",
"format": "datetime"
},
"id": {
"type": "string"
},
"selfLink": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"lists": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/list"
}
},
"kind": {
"type": "string"
},
"etag": {
"type": "string"
}
}
},
"taskSimple": {
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"oauth2": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
"tokenUrl": "https://www.googleapis.com/oauth2/v4/token",
"scopes": {
"https://www.googleapis.com/auth/tasks": "access to tasks"
}
}
}
}
Step 2: Add the visibility key to hide the getlists operation
In the HTTP method object of the getlists operation, add the x-ntx-visibility key with a value of internal.
Nintex Automation Cloud hides the getlists operation.
"paths": {
"/users/@me/lists": {
"get": {
"tags": [ "Task List" ],
"summary": "List Tasklists",
"description": "List Tasklists",
"operationId": "getlists",
"x-ntx-visibility": "internal",
"produces": [ "application/json" ]
}
}
}
Step 3: Add the visibility key to hide the response configuration fields
The response configuration fields are not useful to our workflow design. Add the x-ntx-visibility key with a value of internal to each of the response properties.
Nintex Automation Cloud hides the response configuration fields.
"lists": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/list",
"x-ntx-visibility": "internal"
}
},
"kind": {
"type": "string",
"x-ntx-visibility": "internal"
},
"etag": {
"type": "string",
"x-ntx-visibility": "internal"
}
}
}
The OpenAPI Specification
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Google Tasks"
},
"host": "www.googleapis.com",
"basePath": "/tasks/v1",
"schemes": [ "https" ],
"produces": [ "application/json" ],
"paths": {
"/users/@me/lists": {
"get": {
"tags": [ "Task List" ],
"summary": "List Tasklists",
"description": "List Tasklists",
"operationId": "getlists",
"x-ntx-visibility": "internal",
"produces": [ "application/json" ],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/lists"
}
},
"default": {
"description": "Operation Failed"
}
},
"security": [
{
"oauth2": [ "https://www.googleapis.com/auth/tasks" ]
}
]
}
},
"/lists/{tasklist}/tasks": {
"post": {
"tags": [ "Task" ],
"summary": "Create Task",
"description": "Create Task",
"operationId": "createtask",
"produces": [ "application/json" ],
"parameters": [
{
"name": "tasklist",
"type": "string",
"in": "path",
"x-ntx-dynamic-values": {
"operationId": "getlists",
"value-collection": "items",
"value-path": "id",
"value-title": "title"
}
},
{
"name": "task",
"x-ntx-summary": "Task",
"description": "Title of task",
"in": "body",
"schema": {
"$ref": "#/definitions/taskSimple"
},
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/lists"
}
},
"default": {
"description": "Operation Failed"
}
},
"security": [
{
"oauth2": [ "https://www.googleapis.com/auth/tasks" ]
}
]
}
}
},
"definitions": {
"list": {
"type": "object",
"properties": {
"kind": {
"type": "string"
},
"updated": {
"type": "string",
"format": "datetime"
},
"id": {
"type": "string"
},
"selfLink": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"lists": {
"type": "object",
"properties": {
"items": {
"x-ntx-visibility": "internal",
"type": "array",
"items": {
"$ref": "#/definitions/list"
}
},
"kind": {
"type": "string",
"x-ntx-visibility": "internal"
},
"etag": {
"type": "string",
"x-ntx-visibility": "internal"
}
}
},
"taskSimple": {
"type": "object",
"properties": {
"title": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"oauth2": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
"tokenUrl": "https://www.googleapis.com/oauth2/v4/token",
"scopes": {
"https://www.googleapis.com/auth/tasks": "access to tasks"
}
}
}
}
Test the result
Step 1: Add your Xtension
Import the OpenAPI Specification you created into Nintex Automation Cloud:
- Open your Nintex Automation Cloud tenancy.
- Click Xtensions in the dashboard to open the Xtensions page.
- Click in the Private connector list.
- Click Choose a file. Navigate to the OpenAPI Specification on your computer.
- Wait for Nintex Automation Cloud to validate the file.
- Click Next.
- Nintex Automation Cloud detects the OAuth 2.0 security template.
- Type the Client ID in the Client ID field.
- Type the shared secret in the Client Secret field.
- Click Next.
- Edit the Name of the Xtension, which becomes the name of the action group in the Workflow designer.
- Edit the Description of the Xtension. This appears in the Private connector list in the Xtensions page.
- Select or upload an icon for the Xtension. This is displayed for each action or event in the Workflow designer.
- Click Publish.
Step 2: Authorize the redirect URL
The API will only accept requests that redirect to URLs that have already been authorised for the OAuth2 credentials. To authorise the redirect URL:
- Open the Credentials section of the Google Developer Console.
- Edit the OAuth2 credentials you created earlier.
- Paste the Redirect URL you copied into the Authorized redirect URIs field.
- Click Save.
Step 3: View the custom action group
- Click Create workflow in your Nintex Automation Cloud tenancy.
- Scroll down the action toolbox to the Google Tasks action group.
- Only the Create Task action is displayed.
Drag the Create Task action to the canvas and open the configuration. - The response configuration fields are hidden.