Node red flow for Fight Match

IBM Bluemix & Gamestop Hackathon

[{"id":"63c89d6.f9c3764","type":"http in","z":"f8016f03.07fe9","name":"","url":"/statestores","method":"post","swaggerDoc":"","x":92,"y":68,"wires":[["5a032765.a5fcd8"]]},{"id":"5a032765.a5fcd8","type":"function","z":"f8016f03.07fe9","name":"extract state","func":"context.global.specifiedState = msg.payload.items[0].form.textinput34;\nreturn msg;","outputs":1,"noerr":0,"x":294,"y":23,"wires":[["cd31bf17.32ce4","7c9c531b.8363ac"]]},{"id":"cd31bf17.32ce4","type":"http response","z":"f8016f03.07fe9","name":"","x":512,"y":26,"wires":[]},{"id":"b48b7805.4b7488","type":"http in","z":"f8016f03.07fe9","name":"","url":"/statestores","method":"get","swaggerDoc":"","x":93.5,"y":133,"wires":[["6f16e45b.90e91c"]]},{"id":"1701194c.e8fee7","type":"http response","z":"f8016f03.07fe9","name":"","x":499,"y":117,"wires":[]},{"id":"6f16e45b.90e91c","type":"http request","z":"f8016f03.07fe9","name":"","method":"GET","ret":"obj","url":"https://api.apim.ibmcloud.com/gamestop/prod/gamestop/stores/?client_id=b832ee2e-8ae3-4e6d-b7cb-1c217e2d19b5&client_secret=cR7pU7pM8iG5pH1hN4yM3iU5wB7eV4wV2vO8pU4lO6lL0dM8hW","x":225,"y":199,"wires":[["da2e10f8.25d1f"]]},{"id":"da2e10f8.25d1f","type":"function","z":"f8016f03.07fe9","name":"filter state","func":"var filteredStores = [];\n\nfor (var idx=0; idx < msg.payload.length; idx++) {\n   var currStore = msg.payload[idx];\n   if (currStore.STATE === context.global.specifiedState) {\n       filteredStores.push(currStore);\n   }\n}\nmsg.payload = filteredStores;\n\nreturn msg;","outputs":1,"noerr":0,"x":314,"y":116,"wires":[["1701194c.e8fee7","455c4cff.baa3b4"]]},{"id":"7c9c531b.8363ac","type":"debug","z":"f8016f03.07fe9","name":"","active":true,"console":"false","complete":"false","x":522,"y":65,"wires":[]},{"id":"455c4cff.baa3b4","type":"debug","z":"f8016f03.07fe9","name":"","active":false,"console":"false","complete":"false","x":516,"y":173,"wires":[]}]
jgao1

Flow Info

created 1 year, 6 months ago

Node Types

Core
  • debug (x2)
  • function (x2)
  • http in (x2)
  • http request (x1)
  • http response (x2)

Tags

  • bluemix
  • hackathon
  • gamestop
  • node-red
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option