Blynk without hardware just HTTP REST

Hi,

I just discovered blynk, great project! :+1:

Is it possible to create a new project within the app, copy the generated auth-token into
the HTTP REST example and read/write the virtual wires?

I have read the HTTP RESTful API docs and tried to read the v1 pin. But using the auth token from the App results in an “Invalid token.” - error! :confused:

I want to use it to control a piece of software on my PC without “real” connected hardware.

1 Like

Hello. Yes. You can. Do you use Blynk Cloud? Please show me URL you are using.

Yes I do, but everything the API returns is “Invalid token.”

@eltomato You most probably using URL of blynk-qa (URL in API description), that is not Blynk Cloud.

Try this one http://cloud.blynk.cc:8080/your_token/pin/V1

1 Like

Thats a BINGO!

Thank you very much!

I couldn’t find it in the docs. Maybe this endpoint should be added to the Apiary docs

It is still under testing. We will publish it when ready.

@Dmitriy can we only read the virtual pins at present with HTTP REST i.e. write is not enabled?

@Costas write is enabled. Method type : PUT. See API description.

1 Like

I tried it with php as:

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://cloud.blynk.cc:8080/c19a7a406e194684a2648ebxxxxx/pin/V7");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

curl_setopt($ch, CURLOPT_POSTFIELDS, "[
  \"1\"
]");

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

Server error, the read for php is fine.

I think here is something wrong with escaping of value.

What is blynk-qa?
Can you explain more?

@sh.abar.mard This topic is almost two years old… whatever was being referred too, assuming it wasn’t a typo, is unlikely to be relevant anymore :wink:

Refer to here for current Blynk HTTP RESTful API info and create another new topic if required.