ERPNext API with Arduino

Everyone,

I’m working on developing a program for arduino to connect to ERPNext. I hope to use it to create all kinds of automation, Including handheld RFID readers and fingerprint scanners.

I’m getting stuck early on, I’m hoping someone here can help. I can send the request, and it logs me in, but so far I can’t access the header.

Here’s the code: https://github.com/cgpurbaugh/RFID/blob/master/RFID.ino

Here’s the response:

[HTTP] POST… code: 200
Header count: 5
system_user =
user_image =
user_id =
full_name =
sid =
Res 1 = {“home_page”:"/desk",“message”:“Logged In”,“full_name”:“Feather Huzzah”}

2 Likes

This is an excerpt from our android smart panel project that is still in testing, running javascript. I looke like the JSON wants the headers to be a some key value pairs. I did not work on this code personally, so that’s the limit of the “help” I can provide. Good luck Chris.

return requestPromise.post({
            url: _this.baseUrl + "/api/method/login",
            jar: _this.cookieJar,
            body: formData,
            headers: {
                'Content-Length': contentLength,
                'Content-Type': 'application/x-www-form-urlencoded'
            }