Reading from Terminal with RESTful API

Hello community,

I am using the RESTful API to communicate with my Blynk app.

By using: http://blynk-cloud.com/auth_token/update/pin
I can update both a Value Display and a terminal.

By using: http://blynk-cloud.com/auth_token/get/pin
I can read from a Value Display but NOT from a terminal

Any guesses?
thx.

Terminal is not currently supported, try sending data to a different widget.

You mean dont use the terminal widget to get user input? Cause writing from my application to the terminal window is working just fine.

If I can’t read from the terminal then what would be the best alternative?

thx.

No it’s fine for this, it’s just not covered by the API.

You could code up duplication of the Terminal to a Value Display and read that with the API.

Ok… would you mind elaborate this? I guess I understand what you are saying (mirroring the terminal input to a Value display) but I’m not sure how to do it.

Value Displays can obviously contain a lot less text than the Terminal so decide what is important and “copy it”.

If Value Display is on V6:

Blynk.virtualWrite(V6, thatimportantstringsenttoterminalbyuser);

User input via Terminal is not normally totally random. So for example you might ask a user to answer yes or no and send 1 or 0 to an additional widget. Or you might use C++ switch for one of 20 options and send the corresponding number etc.

Ok… I am confused. Maybe I was not really clear before.

My device can display text and whatever on the Terminal widget. If I enable the input line on the widget the user supposed to be able to send messages back to my device, right? Well, my problem is that my device can’t read the user’s input thru the rest API.

How else I can get string input from the user sent to my device? The user can’t change the value of a Value Display.

No but you can, I understand your problem and it’s covered by:

Blynk.virtualWrite(V6, thatimportantstringsenttoterminalbyuser);

Just define this variable and use it in the BLYNK_WRITE for Terminal:

String thatimportantstringsenttoterminalbyuser;

Understand?

Ah OK, I think I got it… I can’t use this solution, because the device (actually rather an application) I try programming has nothing to do with Blynk supported devices. I can use the REST API to communicate back and forth.

Maybe you should look at using the power of Blynk then.

uhm… what? :slight_smile:

Well this is a Blynk forum so it’s primary purpose is to provide support for devices that use Blynk.

Well, thanks a lot for educating me. As far as I know this is the Blynk forum so my questions about Blynk should be asked here, no matter the device I use.

Good luck with that.

Thanks! And thanks for trolling away my question.

2 Likes

@istvanb just did a test. All works for me. Please show your requests or explain in details what do you mean by “can’t get value”. Terminal returns value via http api.

Why?

@istvanb I just did a fix, so terminal will return all stored values it has. But actually terminal just returns last value, so probably in your case hardware overrides user input.

Hmm odd…

please check the following link: http://cloud.blynk.cc/a4ac2a3fc33f4a7d83ceed4da06450b6/pin/V10

For me it returns nothing, while I have successfully wrote strings to it from my program and I have entered a user input from my phone. My hardware for sure doesn’t overwrite anything, as terminal is not yet integrated (because I couldn’t make it work).

Probably something trivial, maybe I use a wrong request to read the value. (its the same I use to read for example from a value display, and for that it works without an issue)

@istvanb are you sure terminal is on Virtual pin 10? Also host is wrong. It should be blynk-cloud.com
Please send me your login email.