You can use the Viam web app to control your machines, or the Viam SDKs to develop frontend and backend applications. But if you want to explore what's happening behind the scenes, let's use Viam's gRPC API to control a rover.
Follow along with the step-by-step video.
In Postman, fork the following collection to your own workspace.
Postman creates your fork in the selected workspace. You can now update this version of the collection as you wish. If you optionally chose to watch the collection, you can pull changes to your own collection when the main collection is updated.
For each folder and request, review the companion documentation in the context bar to the right.
api_key
, api_key_id
, and machine_url
as Postman variables and Save your changes. In the next section, let's learn about generating access tokens.
To authorize subsequent calls to the Viam server running on your smart machine, generate access tokens in Postman.
AuthService / Authenticate
method to generate an access token. Under the Messages tab, notice you are using your api_key
and api_key_id
to authorize the call to the app_url
. Under the Scripts tab, notice code that saved the access token as a variable app_access_token
for you to re-use in subsequent requests. ExternalAuthService / AuthenticateTo
method to generate an access token. Under the Scripts tab, notice code that saved the access token as a variable machine_access_token
.machine_access_token
variable under the Authorization tab expressed with double curly braces like {{machine_access_token}}
using the Bearer token
authorization type in order to make calls to your machine_url
. Check out the documentation for more details about each request in the context bar on the right side of Postman.
RobotService / ResourceName
method to get a list of resources associated with your machine. Notice you are using your machine_access_token
to authorize the call to your machine_url
. base
component, and make a note of the component's name
. We will need it for the next step. BaseService / Spin
request. Once again, you are using your machine_access_token
to authorize the call to your machine_url
. This time, additional information is required. Under the Messages tab of your request, update the name
property to the name of your own base
component retrieved in the previous step. From here, you can continue updating the payload, exploring other hardware Components, software Services, and experiment with other cloud capabilities, such as machine learning.
This tutorial was a hands-on introduction to the Viam gRPC API. Browse other methods available using server reflection, or see some of them documented in the Viam gRPC API collection as a reference. Read more about how Viam uses gRPC and WebRTC for system architecture.
In most cases, you won't be developing applications or controlling them using the raw gRPC APIs. Instead, check out these resources:
Once you learn the fundamentals of working with your machine, you can start adding more intelligence and capabilities, such as the following.