Originally published at: RICOH THETA API Examples - RICOH THETA Developer Community
The new RICOH THETA API Introduction video shows basic development concepts by showing how to access the API with three different techniques.
- curl HTTP requests on the command line
- HTTP testing tool Insomnia (similar to Postman)
- Testing the HTTP requests inside a barebones mobile app
After reading the RICOH THETA API Getting Started article, you are likely already testing the camera API.
Sharing RICOH THETA API Tests with curl
Most people share tests as curl scripts. This is easy because curl usually exists on MacOS, Windows and Linux.
In addition to HTTP GET requests, you can also use curl to send HTTP POST requests, either with a body or without.
Using Specialized API Testers like Insomnia and Postman
Although curl is ubiquitous and easy to send basic commands, it does get increasingly difficult to test multiple commands in sequence and to keep a series of tests saved.
After testing out curl, I recommend using a specialized HTTP API testing tool.
The HTTP response will be nicely formatted.
The image and video files on the camera are accessible with URLs. You can click on the URL in the Insomnia response window to see the picture on the camera that you took for testing.
Advantage of Testing the RICOH THETA API in Barebones Mobile Apps
Mobile apps have several advantages for testing.
- Using the actual Wi-Fi chipset in iPhones and Pixel physical device phones is a better way to test the camera to device connection. The Wi-Fi chipset in your Windows or Mac computer may exhibit different behavior when connecting to the RICOH THETA camera as a Wi-Fi hotspot. If your target device is a something like a Pixel 4, then it is better to test the application on a physical device Pixel 4 instead of a Windows Android Virtual Device.
- It’s easier to solve network security and routing behavior problems if you’re using the physical device. For example, turning on mobile data and bluetooth on the physical device may change how routing is done to an HTTP endpoint at 192.168.1.1 if the endpoint is not connected to the Internet. Another issue is that sending data to http and not to https may be blocked in the default behavior of iOS and Android. You may need to set up an exception rule in the mobile app build configuration.
- It’s easier to test a sequence of real-world commands. For example, you can configure a startCapture button to set the camera fileFormat settings. It can then set the captureMode to video, and finally execute startCapture. There may also be timing considerations such as waiting 500ms between changing the captureMode and running startCapture.
Download Barebones Apps for RICOH THETA API Mobile App Testing
To make it easy to test different scenarios, we’ve built 4 different barebones apps.
- RICOH THETA API Camera Connection – Camera as HTTP endpoint. HTTP GET and POST request format. Header format. POST request with body
- Using RICOH THETA API Response to Update App Screen – Camera response is JSON. Encode into object for the language you are using to extract information such as battery level. Update mobile app interface when camera response is received.
- RICOH THETA API App State Management with BLoC – List thumbnails at reduced size for network efficiency. Show 360 image with navigation. Set 8K 2fps and 8K 5fps video. Switch between image and video mode. Extract URL of files on camera using listFiles. Use Business LOgic Components to separate logic from GUI and application state.
- THETA X Multi-Bloc – simple app will show multiple screens with one Bloc attached to each screen.
Summary of Testing Workflows
It may be easier to share your API test as a curl script if you share the test in the theta360.guide forum or as an email attachment. However, for daily testing, I find it easier to use a specialized API testing tool like Insomnia or Postman. I also like to build simple mobile apps with a small feature set to test behavior on physical mobile phones.