RICOH THETA API Testing - Making Videos, Getting Options, Getting List of Files

This is how to get the current options and setting the options on your camera. It will return to you the state of an option like which filter it has on, or which capture mode it’s on. You can also set a filter on your camera. I’m using insomnia as my api tester, on a windows laptop and will be using the options section from the RICOH THETA api github
https://github.com/ricohapi/theta-api-specs/tree/main/theta-web-api-v2.1#options

How to get the Capture Mode of the Camera:

Steps:

  1. Create a new Request
  2. Rename it to something like “Get Option Capture Mode”
  3. Change the Request type to POST
  4. Enter the API command: http://192.168.1.1/osc/commands/execute
  5. Change the Body type to JSON
  6. In the Headers Section Make sure you insert the correct Content-Type which is: application/json;charset=utf-8

  1. Inside the JSON Body make sure you set the name to camera.getOptions and add a parameters JSON object with an Array of optionNames as shown in the screenshot below. Another example of the getOptions command is linked in the API Docs here
    https://github.com/ricohapi/theta-api-specs/blob/main/theta-web-api-v2.1/commands/camera.get_options.md

  1. When you send the command you should get your response to the right! In my case my capture mode is in image

respGetoptions

Curl Example Below:

How to add more Options?

Add in more strings with commas as shown below for more options like _filter, sleepDelay, offDelay, _colorTemperature

More options can be found in the API link

https://github.com/ricohapi/theta-api-specs/tree/main/theta-web-api-v2.1#options

commasmore

How to get a list of files?

Steps:

  1. Create a new Request
  2. Rename it to something like “Get List Files”
  3. Change the Request type to POST
  4. Enter the API command: http://192.168.1.1/osc/commands/execute
  5. Change the Body type to JSON
  6. In the Headers Section Make sure you insert the correct Content-Type which is: application/json;charset=utf-8
  7. Inside the JSON Body make sure you set the name to camera.listFiles and inside the parameters object add in the required parameters which are fileType, entryCount, and maxThumbsize. The screenshot below shows the parameters. All the options that are required DO NOT show as optional in the API docs here https://github.com/ricohapi/theta-api-specs/blob/main/theta-web-api-v2.1/commands/camera.list_files.md
    Request

    Response

How to make a video with the API!

The general steps that are going to be taken for this is we are going to:

  • Set the Capture Mode of the camera to Video
  • Start the Video with an API command
  • Stop the Video with an API command
  • Check the latest file of the Camera

The Screenshot above shows setting the option of captureMode to video

Steps:

  1. Create a new Request
  2. Rename it to something like “Set Capture Mode to Video”
  3. Change the Request type to POST
  4. Enter the API command: http://192.168.1.1/osc/commands/execute
  5. Change the Body type to JSON
  6. In the Headers Section Make sure you insert the correct Content-Type which is: application/json;charset=utf-8
  7. Inside the JSON body as shown in the screenshot above you want to set name to camera.setOptions and add the parameters called options which is a JSON object and inside options you want to add captureMode while setting it to video. This is the link to captureMode in the API https://github.com/ricohapi/theta-api-specs/blob/main/theta-web-api-v2.1/options/capture_mode.md#capturemode
  8. Lastly Send the command

Now that the Capture mode is in Video we can startCapture. Below is an example of the startCapture command.

  1. Create a new Request
  2. Rename it to something like “Start Video”
  3. Change the Request type to POST
  4. Enter the API command: http://192.168.1.1/osc/commands/execute
  5. Change the Body type to JSON
  6. In the Headers Section Make sure you insert the correct Content-Type which is: application/json;charset=utf-8
  7. Inside JSON body you want to add the command name as camera.startCapture and you can leave parameters empty or exclude it as show in the above screenshot for startCapture
  8. For Stop you can Duplicate the “Start Video” Request, rename it to “Stop Video” and change the command name to camera.stopCapture as shown in the screenshot below


stopcapreq

Now that your camera capture mode is in video and we have the Start and Stop commands you are set up and can start your video by sending in the Start video command. When you send the Stop command you should be getting a response of the fileUrls of the video you have taken.

startCapture API Link -

https://github.com/ricohapi/theta-api-specs/blob/main/theta-web-api-v2.1/commands/camera.start_capture.md

stopCapture API Link -

https://github.com/ricohapi/theta-api-specs/blob/main/theta-web-api-v2.1/commands/camera.stop_capture.md

2 Likes

Thanks for putting this together. I think you should next try to use node with JavaScript on the command line.

Could you add a picture of your hardware setup? I’d like to see a picture of the THETA X next to the laptop to better understand your work environment.

Could you link to your previous post? It has a good intro section telling what your development environment is like. In case someone starts reading with this post and doesn’t know how you’ve got your development machine set up. I’m referring to this section:

To get started on using the Camera’s API, it’s best to have two separate network connections on your computer, one connection for your internet usage and browsing, and another connection for the Camera’s wifi network. On the laptop I’m using, I have an Ethernet connection on one network for my internet browsing. I am also using the laptop’s own Wifi to connect to another network which is the Theta Camera’s network.