mystack-restapi

0.1.5 • Public • Published

mystack-al

MyStack Abstraction Layer

Install notes:

Create a new express project, or select an existing one

git clone https://github.com/pearsoncloud/mystack-al.git

cd into your gitroot/mystack-al folder and run

npm install

or if you want to download and install the dependencies yourself:

npm install mystack-restapi npm install mystack-vcloud

Start the server:

grunt start

or use node

node app.js

API Reference:

/api/login - Currently supports GET & POST - GET takes no parameters and returns a Token Payload. - POST takes headers for: - xtarget: https://127.0.0.1/ or the base url for the director host - Content-Type: expects application/json - Accept: expects application/json - Account: user@Org - Password: password

                  It requires a login payload example:

                  {
                      "data": [{
                              "code": 0,
                              "type": "",
                              "headers": {
                                  "Accept": "application/*+xml;version=5.1",
                                  "Content-Type": "application/*+xml;version=5.1"
                              },
                              "body": {}
                          }
                      ]
                  }

                  Code is not evaluated on request, and can be set to 0. It will be set on response.
                  Currently based on the interaction, the content type and accept headers within the payload
                  must be set to the proper vmware type. The body too must be vmware's XML payload.
                  The next beta version will perform XML->JSON and JSON->XML translation and abstract away the body h.

                  It returns a JSON structure with the following format:

                  Headers:

                  X-powered-By:   Express
                  Content-Type:   application/json
                  Content-Length: 468
                  Set-Cookie:     connect.sid=s%3A5t9a56Dw7mbvJg0AHswWCwxG.CjmcUf5ILGBG5SicmbfyBb7N1qmPBas485loQs0XyBc; Path=/; HttpOnly
                  Date:           Thu, 07 Nov 2013 14:20:59 GMT
                  Connection:     keep-alive

                  Body:

                  {
                  	"data": {
                  		"code": 200,
                  		"type": "application/vnd.vmware.vcloud.session+xml;version=5.1",
                  		"headers": {
                  			"date": "Thu, 07 Nov 2013 14:21:00 GMT",
                  			"x-vcloud-authorization": "WCnWnaEIyRdfsfdWOrTgY7ejZaCo8UFryq11DoQQBQ8=",
                  			"set-cookie": [
                  				"vcloud-token=WCnWnaEIyR75YcX7eodsfsfjZaCo8UFryq11DoQQBQ8=; Secure; Path=/"
                  			],
                  			"content-type": "application/vnd.vmware.vcloud.session+xml;version=5.1",
                  			"connection": "close"
                  		},
                  		"body": [
                  			60
                  		]
                  	}
                  }

/api/org - Work in progress.....will follow same design pattern as above.

Change notes:

  • v0.1.5 - Changed path handling of configuration for logging, env agnostic.
  • v0.1.1 - Implemented winston logging and configuration file for logging.
  • v0.0.7 - Replaced callback function with q promise instead.

Package Sidebar

Install

npm i mystack-restapi

Weekly Downloads

14

Version

0.1.5

License

BSD-2-Clause

Last publish

Collaborators

  • johnt337