Using curl commands to test basic THETA WebAPI commands

I asked Claude 3.5 Sonnet embedded here in the forum about getting started with the THETA API, specifically requesting curl commands for Mac testing. The discussion covers essential aspects of the RICOH THETA API implementation and testing.

Don’t forget:

  • Basic setup requires WiFi connection to the THETA camera (default IP: http://192.168.1.1)

Main curl commands covered:

My question:

Can you write me a summary of all the curl commands i can use with the THETA API?

Theta_Persona_bot:

I’ll provide a comprehensive summary of the most useful curl commands for the THETA API. These are organized by function category.

Basic Information & Status Commands

# Get basic camera info
curl -X GET http://192.168.1.1/osc/info

# Get camera state
curl -X POST http://192.168.1.1/osc/state

# Check for firmware updates
curl -X POST http://192.168.1.1/osc/checkForUpdates

Image & Video Capture

# Take a picture
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.takePicture"}' \
http://192.168.1.1/osc/commands/execute

# Start video recording
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.startCapture"}' \
http://192.168.1.1/osc/commands/execute

# Stop video recording
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.stopCapture"}' \
http://192.168.1.1/osc/commands/execute

File Operations

# List files (most recent first)
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.listFiles",
         "parameters": {
           "fileType": "all",
           "entryCount": 10,
           "maxThumbSize": 0
         }}' \
http://192.168.1.1/osc/commands/execute

# Delete a file
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.delete",
         "parameters": {
           "fileUri": "100RICOH/R0010015.JPG"
         }}' \
http://192.168.1.1/osc/commands/execute

Camera Settings

# Get camera options
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.getOptions",
         "parameters": {
           "optionNames": ["iso", "shutterSpeed", "whiteBalance", "exposureProgram"]
         }}' \
http://192.168.1.1/osc/commands/execute

# Set camera options
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.setOptions",
         "parameters": {
           "options": {
             "iso": 100,
             "shutterSpeed": 0.004
           }
         }}' \
http://192.168.1.1/osc/commands/execute

WiFi and Power Settings

# Turn off camera
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.closeSession"}' \
http://192.168.1.1/osc/commands/execute

# Set access point info (client mode)
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera._setAccessPoint",
         "parameters": {
           "ssid": "your-network-ssid",
           "security": "WPA/WPA2 PSK",
           "password": "your-password"
         }}' \
http://192.168.1.1/osc/commands/execute

Live Preview

# Start live preview
curl -X POST \
--header "Content-Type: application/json" \
--data '{"name": "camera.getLivePreview"}' \
http://192.168.1.1/osc/commands/execute

Important Notes:

  1. Always use the Content-Type: application/json header for POST requests
  2. The camera must be connected via WiFi
  3. The default IP address is 192.168.1.1
  4. Some commands may vary by camera model
  5. For commands that return a status ID, you can check the status with:
curl -X POST \
--header "Content-Type: application/json" \
--data '{"id": "command-id-returned"}' \
http://192.168.1.1/osc/commands/status

Additional Resources:

1 Like

What is the output of getLivePreview? Is it a stream of characters from curl?

You could save all the curl scripts into a GitHub repo and make it available as a test suite.

@craig The output of getLivePreview is a stream of characters.

I run the command:

jcasman@MacBook-Air-5 ~ %

curl -X POST \

--header "Content-Type: application/json" \

--data '{"name": "camera.getLivePreview"}' \

http://192.168.1.1/osc/commands/execute

I get a warning

Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

I add the output option and create a file called livestream.txt

jcasman@MacBook-Air-5 ~ %

curl --output livestream.txt -X POST \

--header "Content-Type: application/json" \

--data '{"name": "camera.getLivePreview"}' \

http://192.168.1.1/osc/commands/execute

I see this in the terminal, and it’s counting up quickly

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5808k    0 5808k  100    33   394k      2  0:00:16  0:00:14  0:00:02  418k^C

I have a file now called livestream.txt, which contains the output.

Can you extract the frames using the program above

We need a way to confirm that the data is the correct data.

Try ask the AI if it can rewrite the dart program into bash