BOLT cloud API, Bolt Cloud and Bolt Library

I am just trying to know the mechanism of some topics. Please correct me if I’m wrong anywhere and answer my doubts. Thanks in advance.

  1. I want to know what is the Bolt Cloud API? Like I know what it does and its an interface that helps in communication between our application and the bolt cloud server but I want to know what is it physically and where it is located? Like is it a program or set of instructions and where is the program present? In the bolt python library?

  2. Functions like analog read() are api requests to the bolt cloud to read the data from our device. After that it sends response back to us. Please correct me if I am wrong.
    Also, our application sends an api request to bolt cloud, right?

  3. I want to know what is the connection between bolt cloud api, bolt python library and bolt cloud. Like how are they interconnected and work together in case of a project.( say temperature monitoring system)

  4. The functions like analog read(), digital read() etc are part of the Bolt python library, right? And using these functions in our program sends an api request to bolt cloud?

  5. In this line ,
    mybolt= Bolt(api key, device id)
    What are we doing?? Are we sending an api request to bolt cloud to access our device using the credentials? I know its a class where we are passing the credentials but why are we doing this is what I want to know.

Thanks a lot.

Hi @harrisonshruti,

  1. API is a medium with which two applications communicate with each other. Anything you do on the internet, sending a message, check weather on your phone, etc deals with an API.
    Look at API as a service instead of any program. We use that service to get our job done.

What is our job? As a user, it is our job to send a request to the API service with a specific URL which has the instructions already present in it.

Example API URL - https://cloud.boltiot.com/remote/b71b13c6-cab1-456a-aa4e-8e61cb2c01aa/digitalWrite?pin=0&state=LOW&deviceName=BOLT8021328

Here,

https://cloud.boltiot.com/remote/ - is known as the base URL

b71b13c6-cab1-456a-aa4e-8e61cb2c01aa - is the API key (unique to every Bolt account - similar to a table in a restaurant, and the only way the service will reach to you, instead of some other table)

digitalWrite?pin=0&state=LOW - is the service we are requesting to the cloud. Asking the pin 0 to be set digitally LOW (Let’s say we ordered fried rice)

deviceName=BOLT8021328 - is the DEVICE ID (it acts like the user in a table - which person to serve with fried rice)

Now, when you run this URL, it’ll follow the instructions mentioned in the URL. (Give me my fried rice, instead of somebody else)

I hope, this clears your doubt with API services. Also to mention, Bolt API is a program that is present in the Bolt Cloud, the website server.

No, Bolt Python library only uses this service, just like the products section in the Bolt Cloud uses this service when you create a new product.


  1. Yes, functions like analogRead(pin) are programmed inside the bolt python library in a way, so that when you put the parameters of pin and value, it generates an API URL. The API URL includes the api key and deviced id from your conf.py file with the pin and value from your digitalWrite(0, HIGH).

3,4,5 - Every product we create on Bolt Cloud, helps us with making projects faster, as we don’t have to program much. When we choose the select the GPIO, input/output, variable name and pin number. API URL gets ready instantly. We only have to use it in our code section to either control with a button or read an Analog pin.

Python on the other hand is a programming language. Even tho most of the effort was done in Bolt Python library already, it is in our hand, what logic we use to make our projects. It could be an easy program, it could include a high level algorithm to perform that.

When we write mybolt.digitalWrite(0,HIGH), mybolt was previously defined in the line mybolt = Bolt(conf.api, conf.device_id). Where api and device_id are put by you in the conf.py file.

With this line, mybolt= Bolt(api key, device id) – Our API URL is half ready.

When the program is run and digitalWrite is RUN, the python library has statement which makes an HTTP request to make the API service. What is HTTP request? Think about it as running the URL in python without the browser.


How to use functions like digitalRead, analogRead - Most of the API services return a JSON format which has the details responded back by the cloud to you (user).


Visit the API section in the cloud.boltiot.com > Choose and build necessary API request > Copy or Test the API there itself.

The value you see returned is in the JSON format. Using that, we can check whether a pin(value) is HIGH(1) or LOW(1) OR (755).
In case of writing a data like digitalWrite, it(value) always returns with a (1).

Let me know if you have doubt in any part.

2 Likes

Have you visited https://docs.boltiot.com/docs/introduction earlier?

1 Like

Wow. Thanks for the explanation @akshayan.sinha .
It really cleared up my doubts.

No I haven’t visited it earlier . Thanks for this.

One more thing I want to know is that:
I haven’t used any VPS.
I am using Vscode to make the Bolt projects and they are working just fine.
So what is the job of VPS?

VPS can be used to remotely access any computer over the cloud, or any computer that is present in some other part of the world.

Cloud computing requires creating an instance, i.e. a virtual computer that is present on the internet. (without your PC’s specs being used)

Virtual Machines can also be created on our computer using VirtualBox or VMware. Basically a whole computer inside your computer.(your PC’s specs being used)

It is mostly to access multiple Operating Systems from one PC. You can dual boot your PC too, but it’ll be taking more processor power.

VPS was introduced in Bolt Training, so that students can be familiar with Linux-based OS. Even though it is not necessary to use another OS, students only need to use Python over there. But understanding the concepts on how to use a terminal would be really beneficial for every engineering student. Most of the latest development programming languages are first launched and are compatible with LINUX only. Windows versions are created only later in the future.

You can surely use text editors or IDEs like VSCode, Sublime etc to write Python programs. Even I do so. But I’d suggest you, to use lite Linux or Debian-based OS so that you can ATLEAST create/delete directories/files in them.

1 Like

Thanks. I got it now.

So since Virtual Box or Vmware use our PCs specs so these do not qualify as cloud computing, right?

1 Like

Right. Cloud computing is using a computer over the internet (over the cloud).

1 Like

Thanks a lot. You have been very helpful.