We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

jason_mckee
ServiceNow Employee

Want to try your hand at melding ServiceNow with home brew electronics?   Joshua Bray has put together an awesome lab for the CreatorCon Hack Zone that lets you connect your ServiceNow instance to bare-metal wires, switches and LEDs using an Arduino microcontroller (the same device that powers Fruition's beer bot).

You can get a jump start by looking at Josh's Hack Zone lab instructions and downloading the Arduino IDE and node.js.

Here's Josh demonstrating an early prototype for the lab:

5 Comments
emir_e_eminovic
Giga Contributor

I love it! Are you going to build upon it at the hackthon?


jason_mckee
ServiceNow Employee

We'll have extra buttons and LEDs so if you'd like to see how far you can run with it, we've got the parts!


BenPhillipsSNC
Kilo Guru

...Putting "Hackzone" into a comment here so this shows up via search for hackzone.


Sharique Azim
Mega Sage

 

Hi Everyone,

In my arduino code i trying to connect to my instance with a rest api. But everytime i get HTTPCode as 302, while if querying from postman i am getting 200 OK.

please assist! 

felixacostac
Giga Guru

Ran into the same issue some time ago and I'm wondering if anyone has any other insights.

I was able to partially solve this issue, when making a web service to a MID server, but not directly to ServiceNow.

 

In the end, for IOT devices, MQTT might be better suited rather than REST, but it would be good to understand why a direct web service call to ServiceNow won't work.

 

I'm guessing that there might be some sort of security rule preventing microcontrollers of creating web service calls directly to ServiceNow?

 

In any case, I was able to actually do a web service call to the MID server, but I had to specify the length of the message, which POSTMAN will do, but not the Arduino microcontroller. This same pattern didn't work when doing a POST call directly to ServiceNow.

 

Here is the Arduino code for the web service call in case anyone is interested

//START

unsigned int cLength = postData.length();//Where postData is the message body to be sent

client.beginRequest();
client.post("/api/mid/sa/metrics");//The post URL
client.sendBasicAuth("user", "password"); // send the username and password for authentication
client.sendHeader("Accept", "application/json");
client.sendHeader("Content-Type","application/json");
client.sendHeader("Content-Length", cLength);//
client.beginBody();
client.print(postData);

client.endRequest();

 

//END