Run postman collection file

Hi all!

I want to run a postman collection .json file directly from a dashboard. I can upload a json file but then i need to process that file.

So far, i have this:
I've build a UI dashboard so i can upload a postman collection file.

[
    {
        "id": "5e57a846f02916fe",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "90de0cfe.ca90a",
        "type": "http in",
        "z": "5e57a846f02916fe",
        "name": "",
        "url": "/file-upload",
        "method": "post",
        "upload": true,
        "swaggerDoc": "",
        "x": 180,
        "y": 80,
        "wires": [
            [
                "f44eee6a.fa1a8",
                "7835838e.a259cc"
            ]
        ]
    },
    {
        "id": "f44eee6a.fa1a8",
        "type": "debug",
        "z": "5e57a846f02916fe",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "req.files",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 370,
        "y": 80,
        "wires": []
    },
    {
        "id": "7835838e.a259cc",
        "type": "function",
        "z": "5e57a846f02916fe",
        "name": "",
        "func": "msg.payload = \"Archivo subido OK\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 120,
        "wires": [
            [
                "b2930be5.501e38",
                "264a1aab10076304"
            ]
        ]
    },
    {
        "id": "b2930be5.501e38",
        "type": "http response",
        "z": "5e57a846f02916fe",
        "name": "",
        "statusCode": "",
        "headers": {},
        "x": 530,
        "y": 120,
        "wires": []
    },
    {
        "id": "d052db55e2ac719b",
        "type": "uibuilder",
        "z": "5e57a846f02916fe",
        "name": "",
        "topic": "",
        "url": "lala",
        "fwdInMessages": false,
        "allowScripts": false,
        "allowStyles": false,
        "copyIndex": true,
        "templateFolder": "blank",
        "extTemplate": "",
        "showfolder": false,
        "reload": false,
        "sourceFolder": "src",
        "deployedVersion": "6.4.1",
        "showMsgUib": false,
        "x": 750,
        "y": 40,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "264a1aab10076304",
        "type": "debug",
        "z": "5e57a846f02916fe",
        "name": "debug 18",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 160,
        "wires": []
    },
    {
        "id": "568e9df3cbc2258c",
        "type": "function",
        "z": "5e57a846f02916fe",
        "name": "function 1",
        "func": "\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 180,
        "wires": [
            []
        ]
    }
]

Any clues?.

Thanks a lot!

Some confusion here. You mention UI Dashboard but reference uibuilder. Your flow includes a uibuilder node though so I'll assume that.

Not really clear what you are asking for? You have managed to create a uibuilder page that lets a user input an attached file? Can you get the file data back to Node-RED?

Ok, yes, maybe my misunderstood.

The main point is to try to upload a postman collection JSON file and make it run so i can display the results within the UI.

The main goal will be:

  1. Upload the Json file on the UI
  2. Process in the background the uploaded json file.
  3. Show the output of the request on the UI.

Regards!

Maybe this will help

[{"id":"badef399114c7186","type":"debug","z":"b9860b4b9de8c8da","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":210,"y":4400,"wires":[]},{"id":"1a5eaffe20d55f62","type":"http in","z":"b9860b4b9de8c8da","name":"","url":"/file-upload","method":"post","upload":true,"swaggerDoc":"","x":220,"y":4440,"wires":[["badef399114c7186","24ce2c4bda306c7e"]]},{"id":"24ce2c4bda306c7e","type":"function","z":"b9860b4b9de8c8da","name":"function 27","func":"if (msg.req.files[0].originalname.split(\".\")[1]===\"json\"){\n    msg.payload = msg.req.files[0].buffer.toString();\n}else{\n    msg.statusCode = 500;\n    msg.payload = {\"error\":\"no json\"}\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":4440,"wires":[["92ec36e4483fc524"]]},{"id":"92ec36e4483fc524","type":"json","z":"b9860b4b9de8c8da","name":"","property":"payload","action":"","pretty":false,"x":530,"y":4440,"wires":[["0f7d00e07dfb9794","39575309ba1a1ebd","6533e56418aa6859"]]},{"id":"0f7d00e07dfb9794","type":"debug","z":"b9860b4b9de8c8da","name":"debug 311","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":4500,"wires":[]},{"id":"39575309ba1a1ebd","type":"http response","z":"b9860b4b9de8c8da","name":"","statusCode":"","headers":{},"x":650,"y":4440,"wires":[]},{"id":"6533e56418aa6859","type":"ui_text","z":"b9860b4b9de8c8da","group":"c1de91543c517b44","order":1,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":670,"y":4580,"wires":[]},{"id":"073bfdd2b72907ab","type":"ui_template","z":"b9860b4b9de8c8da","group":"c1de91543c517b44","name":"form","order":5,"width":"6","height":"2","format":"<style>\n  label,\n  input {\n    display: block;\n    color: #808080;\n  }\n\n  label {\n    margin-bottom: 10px;\n  }\n</style>\n\n<form id=\"myForm\">\n  <label>\n    <input id=\"myFile\" type=\"file\" name=\"fileToUpload\">\n    </label>\n  <label>\n    <input type=\"submit\" value=\"Upload File\" name=\"submit\">\n    </label>\n</form>\n<script>\n  $('#myForm').submit(function(e) {\n        e.preventDefault();\n        var fd = new FormData();    \n        fd.append( 'file', $('#myFile')[0].files[0] );\n\n  $.ajax({\n    url: '/file-upload',\n    data: fd,\n    processData: false,\n    contentType: false,\n    type: 'POST',\n    success: function(data){\n      alert('Ok');\n      $(\"#myForm\")[0].reset();\n      },\n    error: function(errMsg) {alert(errMsg.responseText)}\n    });\n  });\n</script>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":410,"y":4400,"wires":[[]]},{"id":"c1de91543c517b44","type":"ui_group","name":"Upload Files","tab":"f5bc4cdce2c30720","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"f5bc4cdce2c30720","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

yes, it helps a lot!.

Now, the next step is to run that collection so the output can be printed on the dashboard.

Regards!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.