@jupiterbak/ayx-node
TypeScript icon, indicating that this package has built-in type declarations

0.1.13 • Public • Published

ayx-node

Another Alteryx TypeScript SDK

A NodeJS Library for Alteryx Server - TypeScript SDK - Development Proxy

Build The MIT License npm downloads Total alerts Language grade: JavaScript GitHub release

The repository implements a typescript SDK which can be used to interact with the Alteryx Server APIs. It is compatible with linux, windows and MacOS. It supports both frontend (browser e.g. angular, react...) and backend development in node.js.

SDK

Quick Links

what where
documentation coming soon
generated api-doc jupiterbak.github.io/ayx-node
npm package @jupiterbak/ayx-node
source https://github.com/jupiterbak/ayx-node
changelog CHANGELOG.md
contributing CONTRIBUTING.md
license LICENSE.md

Installation

The recommended way to get started using the nodejs is by using the npm (Node Package Manager) to install the dependency in your project.

After you've created your own project using npm init, you can run:

npm install @jupiterbak/ayx-node --save
# or ...
yarn add @jupiterbak/ayx-node --save

This will download the this library and add a dependency entry in your package.json file.

If you are a Typescript user, you will need the Node.js type definitions:

npm install -D @types/node

Quick Start

This guide will show you how to set up a simple application using Node.js that allows you to interact with an Alteryx server. Its scope is only to list all the workflows present in your workspace.

Create the package.json file

First, create a directory where your application will live.

mkdir myProject
cd myProject

Enter the following command and answer the questions to create the initial structure for your new project:

npm init -y

Next, install the this SDK as a dependency.

npm install @jupiterbak/ayx-node --save

Connect to your Alteryx server

Create a new app.js file inside the folder myProject and add the following code to read all the workflows listed in your workspace:

const { AlteryxSdk } = require('@jupiterbak/ayx-node');
// or as an es module:
// import { AlteryxSdk } from '@jupiterbak/ayx-node'

// Alteryx Server REST API Connection URL
const url = 'http://localhost/webapi/';
const clientId = '8DA3C9A7E88FD2Ebe586219847b7f9b5b1bd0f8c31c3b20ca5f2a9ea54e107a173f379128b3b6b1';
const clientSecret = 'cb1d3a6287f0d86e88169963045512be40dd28771c93d404450d0279c743611a';

// Instantiate the library
const sdk = new AlteryxSdk({
    gateway: url,
    clientId: clientId,
    clientSecret: clientSecret
});

async function main() {
    // Get the workflow management client. Multiple client are supported as well
    const wClient = sdk.GetWorkflowManagementClient();

    // List all the workflows in my workspace
    const workflows = wClient.GetWorkflows();
  
    // the following code examples can be pasted here...
  
    return workflows;
  }
  
main()
.then(console.log)
.catch(console.error);

NOTE: Please follow these intructions to read the clientId and the clientSecret of your server.

Alteryx Help: https://help.alteryx.com/developer-help/server-api-overview

Run your app from the command line with:

node app.js

The application should print all the workflows of your workspace into the console.

Running Unit Tests

In order to run unit tests, please follow these steps:

Step 1: Clone this repo.

git clone https://github.com/jupiterbak/ayx-node.git
cd ayx-node

Step 2: Install the dependencies.

npm install

Step 3: Set the environment variables: AYX_SERVER_API, AYX_SERVER_CLIENTID, and AYX_SERVER_CLIENTSECRET.

export AYX_SERVER_API="http://localhost/webapi/"

export AYX_SERVER_CLIENTID="8DA3C9A7E88FD2Ebe586219847b7f9b5b1bd0f8c31c3b20ca5f2a9ea54e107a173f379128b3b6b1"

export AYX_SERVER_CLIENTSECRET="cb1d3a6287f0d86e88169963045512be40dd28771c93d404450d0279c743611a"

Step 4: Start testing. Run the following

npm run test

After a sucessfull startup the following output should be printed.

...

    ✔ 1. should instantiate
    ✔ 2. should list all user groups @sanity
    ✔ 3. should create new user group
    ✔ 4. should update user group
    ✔ 5. should add user to user group (49ms)
    ✔ 6. should remove user from user group
    ✔ 7. should delete user group

  [SDK] Workflow Management Client
    ✔ 1. should instantiate
    ✔ 2. should list all existing workflows @sanity
    ✔ 3. should list all workflows with a name
    ✔ 4. should list all workflows with full view
    ✔ 5. should list all workflows with full view
    ✔ 6. the crud operations on workflows should work (229ms)
    ✔ 7. should list all workflows within my subscription (47ms)
    ✔ 8. should list all jobs for the first workflow within my subscription (704ms)
    ✔ 9. should list all the questions for the first workflow within my subscription (174ms)
    ✔ 10. should return the original package containing the first workflow within my subscription (587ms)
    ✔ 11. should start a job with the first workflow within my subscription (195ms)


  69 passing (6s)

Supported Alteryx Server APIs

Name AYX Server API Version SDK - Client
Collection Management V3 ✔️
Credential Management V3 ✔️
DCME Connection Management V3 ✔️
Schedule Management V3 ✔️
Server Connection Management V3 ✔️
Usergroup Management V3 ✔️
User Management V3 ✔️
Workflow Management V3 ✔️
Admin Management Tasks V2 ✔️
Usergroup Management V2 ✔️
User Management V2 ✔️
Admin Management Tasks V1 ✔️
Job Management V1 ✔️
Workflow Management V1 ✔️

Proxy support

Set the http_proxy or HTTP_PROXY environment variable if you need to connect via proxy.

# set http proxy environment variable if you are using e.g. fiddler on the localhost.

export HTTP_PROXY=http://localhost:8888

Change Log

Change history can be found in CHANGELOG.md.

Bugs / Feature Requests

If an API is missing and you would like to contribute a Client for it take a look at CONTRIBUTING.md.

Legal

This project has been released under an Open Source license. The release may include and/or use APIs to Alteryx’ or third parties’ products or services. In no event shall the project’s Open Source license grant any rights in or to these APIs, products or services that would alter, expand, be inconsistent with, or supersede any terms of separate license agreements applicable to those APIs. “API” means application programming interfaces and their specifications and implementing code that allows other software to communicate with or call on Alteryx’ or third parties’ products or services and may be made available through Alteryx’ or third parties’ products, documentations or otherwise.

Package Sidebar

Install

npm i @jupiterbak/ayx-node

Weekly Downloads

0

Version

0.1.13

License

MIT

Unpacked Size

2.18 MB

Total Files

252

Last publish

Collaborators

  • jupiterbak