How To

Create a new node api

Api deals with creating new node using as parameter the workspace's token, by associating it to the node (each node has to be associated at least to a workspace) and the user's token for the identification.
Api returns a status code or a configuration json.

Status code

  1. 401 Unauthorized: the user's token used as parameter is not associated with any user or is not authorized to doing this operation.
  2. 500 Internal Server Error: generic error returned by server.

Usage examples

The setting of a node can be done in two ways:

  1. By choosing a distribution which, through a curl call, runs a script using this api
    $ curl -s 'https://git.io/Jv9EF' \
           | bash -s {user_token} {workspace_token}
  2. Manual setting in which are listed all the steps:
    1. clone of the repository
    2. download of the configuration file
    $ git clone 'https://github.com/stormdotdev/stormnode.git' &&
    $ cd stormnode &&
    $ node -e "require('https').get('https://storm.dev/api/v1/makeandget?token={user_token}&allow_remote_update=1&team={workspace_token}', f => {f.pipe(require('fs').createWriteStream('stormnode.json'));});" &&
    $ npm install --production