Your first script ‘Hello World’

Table of Contents
You are here:

Introduction

Okay, now that you have installed the Node-RED on your machine, let’s have a go at executing your first-ever script/flow.
We’ll explain to you how you can create 3D Repo issues outside of 3drepo.io by simply using our APIs.

Hello world!

3D Repo flows provide necessary code to work with your data and visualising them. No coding skills are required to start but getting familiar with the basics of JavaScript is encouraged.

This first flow is set up to work with a Sample_Federation in Sample_Project in your teamspace.
Alternatively, you can run it on any other model if you wish.

  1. Start Node-RED
  2. Go to your Teamspace and open the default Lego_House_Federation model
  3. In a new tab, open Node-RED editor at http://localhost:1880 
  4. From menu in right top corner select Import
  5. In Clipboard, copy code from here (ctrl+A, ctrl+C) and paste it (ctrl+V) in Import nodes dialog in Node-RED editor
  6. Select “new flow”
  7. Hit the Import button. You will see a pop-up message with the successfully imported flows and nodes numbers
  8. Hit “Deploy” button. You will see a pop-up message indicating “Successfully deployed”
  9. In a new tab, open Node-RED dashboard at http://localhost:1880/ui
  10. Fill in your 3D Repo username and password credentials in the Login section
  11. Go back to Node-RED editor
  12. Double-click on “MAIN INPUTS” node
  13. Fill in required fields:
    1. Type in your ‘teamspace’ (identical with your username)
    2. In 3D Repo, open Lego_House_Federation and copy & paste Model ID from your browser’s address bar
    3. Paste your API Key after generating it from your Teamspace
  14. Hit Done button
  15. Hit the Deploy button once again
  16. Go to Sample_Federation in 3D Repo
  17. A new issue called “Hello world!” appears in the Issues tracker and/or in the Issues & Risks section when picking the adequate Model/Federation

  18. In case you encounter node-specific errors in Node-RED, ‘Debug messages’ icon help to debug by identifying the nature of those errors

Congratulations! You have successfully deployed your first flow. Now try something more useful. You can find more samples and tutorials here.

Troubleshoot

If your flow doesn’t work and you get “no response from server” and “Error: socket hang up” errors from HTTP node, try increasing maximum API request timeout and limit:

  1. Go to Node-RED folder C:Users***.node-red
  2. Open settings.js

  3. Uncomment and change the following:
    httpRequestTimeout: 1200000,
    apiMaxLength: ’50mb’

For more information about the Issue requests, head over to our APIs Docs.